Reputation: 1
I am having hard time to figure out why scope inside directive does not work. What I am doing wrong. Program should be able to remove an item by clicking button, but scope does not work, if I comment out scope in directive data is there otherwise nothing is happening. User is supposed to search for an item in menu and based on criteria items will be shown, for example enter chicken and number of items should show, beside each item should show up button and by pressing that button that item should be removed. This does not work. if anyone can have look and give me an answer what is wrong I'd kindly appreciate. By the way I am new to AngularJS and trying to learn.
function FoundItemsDirective(){ var ddo = {
scope: {
//items: '<',
//myTitle: "@",
onRemove: '&'
//visible: '='
},
templateUrl: 'foundItems.html'
// controller: NarrowItDownDirectiveController,
// controllerAs: 'narrowDown',
// bindToController: true
};
return ddo;
}
Here is link to plunk http://plnkr.co/edit/s9Fh4RkXIhrhLoVv8ZT2?p=preview
Upvotes: 0
Views: 132
Reputation: 1
Thanks to everyone who tried to help, I figure out by myself this one.
function FoundItemsDirective(){
var ddo = {
templateUrl: 'foundItems.html',
scope: {
found: '<',
onRemove: '&'
},
controller: NarrowItDownDirectiveController,
controllerAs: 'narrowDown',
bindToController: true
};
return ddo;
}
Here is plunk http://plnkr.co/edit/s9Fh4RkXIhrhLoVv8ZT2?p=preview
Upvotes: 0