0

I'm having trouble binding a controller array with a directive :

Markup :

<custom-directive item="tag" selectedItems="selectedArray" ng-repeat="tag in tags"></custom-directive>

Controller :

 $scope.selectedArray= [];

Directive :

scope: {
         item:"=",
         selectedItems:"="
    },
    controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {
//Undefined
console.log($scope.selectedItems);
}

The binding for item works fine, what am I doing wrong for selectedItems ?

Thanks

1 Answer 1

1

I found the cause : "selectedItems" as an attribute name doesn't work. You need to use "selected-items". "selectedItems" works fine in the directive scope.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.