각도

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
풀어 주다: 2016-09-28 08:38:25
원래의
1523명이 탐색했습니다.

json을 통해 다중 레벨 선택을 생성했습니다

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

<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는 다음과 같습니다.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

<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를 통해 왜 얻을 수 없는지 모르겠습니다.

관련 라벨:
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿