Angular 1.5 components easily allow creating a call back to the parent from the component. Is there a way i can call a function in a component from a function in parent\'s contr
A few different ways:
scope:{myattr:'='}
) to the task-item-header directive which the directive could then add a function to for the parent controller to call. scope:{myattr:'@'}
) on it and then attrs.$observe
changes to it to trigger the action, or two-way binding (scope:{myattr:'='}
) and then $scope.$watch
changes to it to trigger the action.scope:{raiseLoaded:'&onLoaded'}
) that passes an object that represents a remote control object with a method on it that triggers the action you want. To raise the event, you'd call something like raiseLoaded({remoteControl: remoteControlObj})
within the directive, and then to listen to the event, you'd use
assuming you have a setRemote()
method on your parent controller.Update I just realized your question was for a newer version of AngularJS, so I'm not sure if my answer still applies. I'll leave it here for now, but if you find it is not helpful I can delete it.