I have two directive in the same hierarchy: directive1 and directive2 I want directive2 execute his controller before directive1 without change html directives hierarchy
app.directive('directive1', [function() {
return {
restrict: 'E',
scope: {
},
templateUrl: 'My/views/directive1.html',
controller: ['$scope', function ($scope) {
console.log("Controller of Directive 1");
}]
}
}]
)
app.directive('directive2', [function() {
return {
restrict: 'E',
templateUrl: 'My/views/directive2.html',
controller: ['$scope','$timeout', function ($scope,$timeout) {
console.log("Controler of Directive 2");
}]
}
}]
);
<div ng-controller="test" >
<directive1></directive1>
<directive2></directive2>
</div>