i am using ng-options to iterate some data in angularjs and when selecting value i want a selected Object , For that i have created directive..
return {
require: 'ngModel',
restrict : 'A',
link: function(scope, element, attrs, ctrl) {
$(element).combobox({
source: scope[attrs.reportitems],
select: function(event, ui) {
$timeout(function() {
if(attrs.reportitems=="zoneList"){
if(ui.item.attributes.value.value != "0") {
scope["update"](ui.item.attributes.value.value);
}
}
}, 0);
}
});
},
}
This will call update method in controller and it will pass the index position of data array but i want the object itself instead of index. or somehow trigger ng-change method in UI.so that i can have an Object in update Method in controller. please check this Plunker for whole Code..Link
Can anyone please help ?