0

This works:

<p class="form-control-static">{{ctrl.StatusId}}</p>
<div content-selects ng-model="Statuses" selection="2"></div>

This doesn't

<p class="form-control-static">{{ctrl.StatusId}}</p>
<div content-selects ng-model="Statuses" selection="ctrl.StatusId"></div>

In case one, {{ctrl.StatusId}} shows 2 and my directive works perfectly. In case two, {{ctrl.StatusId}} also shows 2 and my directive doesn't work.

function contentSelects(){
        return {
            restrict: 'AE',
            templateUrl: '/app/Directives/contentSelects.tpl.html',
            replace:true,
            scope: {
                ngModel: '=',
                selection: '='
            },
            controller:function($scope){

            },
            link: function (scope, element, attrs) {

               scope.selectedModel = scope.ngModel[scope.selection];
                console.log(scope.selectedModel);
                scope.isChanged = function () {
                    //console.log("changed");
                }

            }
        };

If I use curly brackets it breaks selection="{{ctrl.StatusId}}". What should I give this attribute so that it recognises the value that's passed?

Underfrog
  • 1,307
  • 11
  • 14

0 Answers0