json을 통해 다중 레벨 선택을 생성했습니다
<code><div ng-app="xx" ng-controller="eee"> <div> **{{col_selectlv[1].colname}}**//这个地方下文说到! <select ng-model="col_selectlv[0]" ng-options="x.colname for x in col_select[0]" required> <option></option> </select> <select ng-model="col_selectlv[1]" ng-options="x.colname for x in col_selectlv[0].children" ng-if="col_selectlv[0].children" required> <option></option> </select> <select ng-model="col_selectlv[2]" ng-options="x.colname for x in col_selectlv[1].children" ng-if="col_selectlv[1].children" required> <option></option> </select> <select ng-model="col_selectlv[3]" ng-options="x.colname for x in col_selectlv[2].children" ng-if="col_selectlv[2].children" required> <option></option> </select> </div> </div></code>
app.js는 다음과 같습니다.
<code> app.controller('newseditor', function ($scope, $http,$routeParams) { $scope.newsid=$routeParams.id?$routeParams.id:'0'; $http({ method: 'GET', url: 'datacon/col_select.php', }).success(function (response) { // console.log(response); if (response) $scope.col_select = response; }) $scope.change_selecter = function (r) { $scope.select_range = r; } $scope.news_submit = function () { console.log($scope.col_selectlv) } });</code>
버튼을 클릭하여 news_submit을 활성화합니다. 원하는 효과는 col_selectlv를 출력하는 것이지만 출력 결과는 정의되지 않습니다.
위에 표시된 {{col_selectlv[1].colname}}이 출력 가능하므로 ng-model은 성공적으로 바인딩되었으나 $scope.col_selectlv를 통해 왜 얻을 수 없는지 모르겠습니다.
답글 내용:
json을 통해 다중 레벨 선택을 생성했습니다
<code><div ng-app="xx" ng-controller="eee"> <div> **{{col_selectlv[1].colname}}**//这个地方下文说到! <select ng-model="col_selectlv[0]" ng-options="x.colname for x in col_select[0]" required> <option></option> </select> <select ng-model="col_selectlv[1]" ng-options="x.colname for x in col_selectlv[0].children" ng-if="col_selectlv[0].children" required> <option></option> </select> <select ng-model="col_selectlv[2]" ng-options="x.colname for x in col_selectlv[1].children" ng-if="col_selectlv[1].children" required> <option></option> </select> <select ng-model="col_selectlv[3]" ng-options="x.colname for x in col_selectlv[2].children" ng-if="col_selectlv[2].children" required> <option></option> </select> </div> </div></code>
app.js는 다음과 같습니다.
<code> app.controller('newseditor', function ($scope, $http,$routeParams) { $scope.newsid=$routeParams.id?$routeParams.id:'0'; $http({ method: 'GET', url: 'datacon/col_select.php', }).success(function (response) { // console.log(response); if (response) $scope.col_select = response; }) $scope.change_selecter = function (r) { $scope.select_range = r; } $scope.news_submit = function () { console.log($scope.col_selectlv) } });</code>
버튼을 클릭하여 news_submit을 활성화합니다. 원하는 효과는 col_selectlv를 출력하는 것이지만 출력 결과는 정의되지 않습니다.
위에 표시된 {{col_selectlv[1].colname}}이 출력 가능하므로 ng-model은 성공적으로 바인딩되었으나 $scope.col_selectlv를 통해 왜 얻을 수 없는지 모르겠습니다.
컨트롤러 이름이 eee입니까 아니면 newseditor입니까? 코드가 불완전한 것 같습니다
ng-if가 하위 도메인을 생성하는 것으로 밝혀졌으므로
app.controller('newseditor', function ($scope, $http,$routeParams) {
<code> **$scope.col_selectlv={}** $scope.newsid=$routeParams.id?$routeParams.id:'0'; $http({ method: 'GET', url: 'datacon/col_select.php', }).success(function (response) { // console.log(response); if (response) $scope.col_select = response; }) $scope.change_selecter = function (r) { $scope.select_range = r; } $scope.news_submit = function () { console.log($scope.col_selectlv) } </code>
<code> }); 要定义一个$scope.col_selectlv,才能够获取到col_selectlv</code>

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

查找方法:1、用strpos(),语法“strpos("字符串值","查找子串")+1”;2、用stripos(),语法“strpos("字符串值","查找子串")+1”。因为字符串是从0开始计数的,因此两个函数获取的位置需要进行加1处理。

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

mPDF
mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

Dreamweaver Mac版
시각적 웹 개발 도구

에디트플러스 중국어 크랙 버전
작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

안전한 시험 브라우저
안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.
