One key aspect of Angular as a framework is how it relies on dependency injection. There are few places you need to "inject" dependencies:
The index.html
:
<!-- Angular Packages -->
<script src="vendors/angular-ui-router.min.js"></script>
<script src="vendors/ngStorage.min.js"></script>
<script src="vendors/angular-cookies.min.js"></script>
The Angular Module:
angular
.module('app', [
'ui.router',
'ngStorage',
'ngCookies'
])
Functions of the module:
.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider){ }]);
Note: that the order of your dependecy injections must be the same as the order of the function parameters! 💥
Dependency injection allows Angular to be modular and makes your code cleaner and pluggable :)
Prev: Directory Structure | Next: States | Home: Lecture Outline