$scope is undefined in angularjs nested loop

时间:2019-03-06 11:43:50

标签: angularjs html5

I have a nested loop of java script array and check boxes(2 ng-repeate) in html page. i am trying to catch the second ng-model values to deal with it in javascript . but when i make console.log it shows undefined. the v.details is undefined the html

<div class="col-xs-12">
    <ul style=" height: calc(100vh - 250px); overflow: auto;" class="Roles_list margin-top-10">
        <li ng-repeat="role in roles" class="list-group-item"
            ng-class="{'activeRoles':role.active&&role.slectd,'list-group-item_active':role.slectd&&!role.active,'activeRoles':role.active}">
            <label style="margin-bottom:0;" ng-click="setClickedRow1(role)">{{role.roleName}} </label>

            <div class="col-xs-12 margin-top-10 " ng-class="{'display-none':!role.slectd&&!role.active||vacations[0].L_Desc==null}" ng-show="role.roleId==7">
                <div class="list">
                    <!--<div class="pull-right">
                        <button class="btn btn-xs btn-info" ng-click="newvacation() ;$event.stopPropagation();$event.preventDefault();" ng-show="role.roleId==7">New</button>
                    </div><br />-->
                    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-6" ng-repeat="v in vacations " ng-class="{'color_Active':v.details==0}">
                        <label>
                            <input ng-model="v.details"
                                   ng-click="selectedvacations(v)"
                                   style=" margin-top: 2px; margin-right: 2px;" id="chkvac" type="checkbox"> {{v.L_Desc}}
                        </label>
                    </div>

                </div>
            </div>
        </li>

    </ul>
</div>

the angular

if ($scope.selectedRoleid == 7) {
    angular.forEach($scope.vacations, function (v) {
        if (v.details == false || $scope.chkemp.length==0) {
            toastr.error("You must select at least one employee");
            return;
        }
    })
}

any help, thanks in advance

0 个答案:

没有答案