I've been struggling to get ng-change to trigger in my directive with an isolated scope. I'm working on transitioning from ng-controller to a more component-based architecture, but it's turning out to be more difficult than I anticipated.
I've created a fiddle that I can't seem to make work. Check out the fiddle
I believe the root of the issue lies somewhere in this snippet:
app.directive("search", function(service) {
return {
restrict: 'E',
replace: true,
scope: {},
controller: ['$scope', function($scope) {
$scope.search = function(keyword) {
service.searchData(keyword);
};
}],
template: '<div style="padding-bottom: 15px;">' +
'<center>' +
'<input type="text" ng-model="keyword" ng-change="search(keyword)"/>' +
'</center>' +
'</div>'
};
});
However, looking at the fiddle will give you a more comprehensive understanding of what I'm trying to achieve.