I have a situation where i want to call a parent controller method from a directive on ng-change. The call to controller method never triggers, not sure what could be wrong. Any help would be much appreciated. Thanks
Sample Code:
<body ng-app="content-app" ng-controller="ParentController">
<div header-menu report-manager="model"></div>
</body>
report-manager is a model.
Header-Menu Directive:
var $module = angular.module('content-app');
$module.directive('headerMenu', function () {
return {
restrict: 'AE',
scope: {
reportManager: '='
},
templateUrl: '/scripts/app/directives/header-menu.template.htm'
};
});
header-menu.template.htm
<div>
<ul>
<li ng-repeat="filter in filters" ng-controller="ChildController" ng-change="method()" />
</ul>
</div>
ParentController.
angular.module('content-app')
.controller("MainController", ['$scope', function($scope) {
$scope.method = function () { // do something };
}]);