격리 된 범위가있는 지시문을 만들었습니다. 어떤 이유로 ng-repeat에서 범위를 벗어난 범위 값에 액세스 할 수 없습니다 반복. 그래서 여기, ng-options 지시문에서 격리 된 범위 속성 authorityList에 액세스하려고하지만 드롭 다운에 채워지지 않습니다.angularjs ng-options 내 드롭 다운을 채우지 않음
(function() {
var app = angular.module('garageManagement');
app.directive('userManagement', function() {
return {
restrict: 'E',
templateUrl: 'app/directives/userManagementWidget/userManagementTemplate.html',
scope: {
users: "=",
authorityList: "=",
acceptUser: "&",
rejectUser: "&",
selectecAuthroity:"=",
}
};
});
}());
템플릿
<div class="form">
<div class="col-12" ng-repeat="user in users ">
<div id="{{user.Id}}" class="row">
<label for="example-text-input" class="col-3 col-form-label">{{user.UserName}}</label>
<div class="col-3">
// issue here, authorityList returning undefined
<select class="form-control" ng-options="item in authorityList" ng-change="storeSelectionUserType(user.Id)" ng-model="user.StaffType"></select>
</div>
<div ng-hide="user.IsApproved" class="col-3">
<button type="button" ng-click="acceptUser(user.Id)" class="btn btn-primary col-3">Accept</button>
</div>
<div ng-hide="user.IsApproved" class="col-3">
<button type="button" ng-click="rejectUser(user.Id)" class="btn btn-primary col-3">Reject</button>
</div>
</div>
</div>
사용
<user-management users="users" authorityList="authorityList" acceptUser="acceptUser" rejectUser="rejectUser" storeSelectionUserType="storeSelectionUserType" selectecAuthroity="selectecAuthroity"></user-management>
문제를 재현하는 플 런커 데모 만들기 – charlietfl