Looking to create a directive that implements isolate scope.
Here's the code snippet:
angular.module('myApp').directive('itemCollection', ['$cookies',
function($cookies) {
return {
restrict: 'E',
scope: {
items: '='
},
link: function(scope) {
console.log(scope.items)
console.log(items)
--> both console.log show undefined
}
};
}
]);
HTML Template
<item-collection items="item1"></item-collection>
Struggling to retrieve 'item1' in the directive and it remains undefined. Unsure of what might be causing this issue. Would appreciate any help on this matter. Thank you!