What happens if multiple directives are on the same element in angularjs

I'm new to Angular JS, I need to know how to get a specific directive to execute first when we have 2 or more directives for the same element. directiveone directive examples directivetwo direvtivethree on div tag

<div>
    <div directiveone directivetwo direvtivethree></div>
</div>

but I need to download directivetwo first and then direvtivethree then direvtiveone.

Please give your suggestions ...

+4
source share
2 answers

You should use the directive priorityto determine which directives should be compiled first.

var myModule = angular.module(...); 
myModule.directive('directiveName', function (injectables) {
  return {
    restrict: 'A',
    template: '<div></div>',
    templateUrl: 'directive.html',
    replace: false,
    priority: 0,
    transclude: false,
    ...

angular , / .

+2

:

app.directive('exampleDirective', function() {
    return {
        priority: *numeric value*,
        restrict: 'A',
        link: function() {

        }
    }
}

- . , 0, .

+1

All Articles