0

This is only happening when I am using directive

Template: (userlist.html)

<select id="teamUsers" ng-model="selectedUser.selected" data-placeholder="Select User" chosen="" class="chosen-select input-md"
        ng-options="user.ID as user.FirstName+' '+user.LastName+', '+user.Team.Name for user in teamUsers"
        ng-disabled="accessDisabled()">
    <option disabled></option>
</select>

Directive:

    App.directive('selectUser', function () {
        return {
            restrict: 'E',
            templateUrl: 'userlist.html',
            controller: ['$scope', '$timeout', '$http', '$rootScope', function ($scope, $timeout, $http, $rootScope) {
                $scope.teamUsers = {
                              ID:1,
                              FirstName:'John',
                              LastName:'Doe',
                              Team:{
                                      Name : 'Web Team'
                                    }
                };
                $scope.accessDisabled = function () {
                    return !$rootScope.HasPermission('ChangeUserControl', 'Control'); // checking permission with return true and false.
                }
                $timeout(function () {
                    //$scope.teamUsers http request basically
                });
            }]

        };
    });

Using in View :

<select-user></select-user>

everything is working perfectly fine, I don't know why ng-disable is miss behaving in my senerio dropdown is not disabling

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Atir Naveed
  • 629
  • 5
  • 3

0 Answers0