Created
August 8, 2014 16:16
-
-
Save iambigd/15b4276e72ddd29f15ff to your computer and use it in GitHub Desktop.
AngularJS 執行順序 (ref:http://stackoverflow.com/questions/20663076/angularjs-app-run-documentation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module('myApp', []); | |
myApp.factory('aProvider', function() { | |
console.log("factory"); | |
}); | |
myApp.directive("test1", function() { | |
console.log("directive setup"); | |
return { | |
compile: function() {console.log("directive compile");} | |
} | |
}); | |
myApp.directive("test2", function() { | |
return { | |
link: function() {console.log("directive link");} | |
} | |
}); | |
myApp.run(function() { | |
console.log("app run"); | |
}); | |
myApp.config( function() { | |
console.log("app config"); | |
}); | |
myApp.controller('myCtrl', function($scope) { | |
console.log("app controller"); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-app="myApp" ng-controller="myCtrl"> | |
<div test1 test2> </div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment