Since the directive is only calling a function (and not trying to set a value on a property), you can use $eval instead of $parse (with a non-isolated scope):
scope.$apply(function() {
scope.$eval(attrs.confirmAction);
});
Or better, simply just use $apply, which will $eval()uate its argument against the scope:
scope.$apply(attrs.confirmAction);
Fiddle
Related Contents:
- What is the difference between ‘@’ and ‘=’ in directive scope in AngularJS?
- AngularJS 1.5+ Components do not support Watchers, what is the work around?
- When writing a directive in AngularJS, how do I decide if I need no new scope, a new child scope, or a new isolated scope?
- Confused about Angularjs transcluded and isolate scopes & bindings
- Rendering directives within $sce.trustAsHtml
- AngularJS: ng-repeat list is not updated when a model element is spliced from the model array
- Directive isolate scope with ng-repeat scope in AngularJS
- AngularJS : ng-repeat filter when value is greater than
- angularjs share data config between controllers
- How to modify scope from within a directive in AngularJs
- Call a method of a controller from another controller using ‘scope’ in AngularJS
- AngularJS : Prevent error $digest already in progress when calling $scope.$apply()
- Controller not a function, got undefined, while defining controllers globally
- How do I access the $scope variable in browser’s console using AngularJS?
- AngularJS access parent scope from child controller
- angular ng-bind-html and directive within it
- How to access parent scope from within a custom directive *with own scope* in AngularJS?
- Angular directives – when and how to use compile, controller, pre-link and post-link [closed]
- How to use the ‘replace’ feature for custom AngularJS directives?
- How do I use $rootScope in Angular to store variables?
- Link vs compile vs controller
- What is the best way to conditionally apply attributes in AngularJS?
- Unit Testing AngularJS directive with templateUrl
- Angularjs dynamic ng-pattern validation
- Sending event when AngularJS finished loading
- Easiest way to pass an AngularJS scope variable from directive to controller?
- Does my ng-model really need to have a dot to avoid child $scope problems?
- if a ngSrc path resolves to a 404, is there a way to fallback to a default?
- Angular: calling controller function inside a directive link function using &
- How to call a function from another controller in AngularJS? [duplicate]
- How do I ignore the initial load when watching model changes in AngularJS?
- Angular directive how to add an attribute to the element?
- How can you limit the value from input using AngularJS?
- AngularJS : $q -> deferred API order of things (lifecycle) AND who invokes digest?
- get original element from ng-click
- Accessing attributes from an AngularJS directive
- Why is using if(!$scope.$$phase) $scope.$apply() an anti-pattern?
- How can I test events in angular?
- How to understand the `terminal` of directive?
- AngularJS – how to override directive ngClick
- Custom form validation directive to compare two fields
- How to set the dynamic controller for directives?
- AngularJs: Reload page
- Bind class toggle to window scroll event
- AngularJS Group By Directive without External Dependencies
- Can an angular directive pass arguments to functions in expressions specified in the directive’s attributes?
- $apply vs $digest in directive testing
- Binding variables from Service/Factory to Controllers
- AngularJS leaves comments in HTML: is it possible to remove them?
- Angular directive for a fallback image