Created
June 2, 2015 14:29
-
-
Save dasibre/277e537f3e0f3e032987 to your computer and use it in GitHub Desktop.
Angular Dependency injection]
This file contains hidden or 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', ['myAppController']); |
This file contains hidden or 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 myAppControllers = angular.module('myAppController', ['myAppServices']); | |
| myAppControllers.controller('HomeCtrl', ['$scope', 'appService', function($scope, appService) { | |
| $scope.name = "James naadjie"; | |
| $scope.site = appService | |
| }]); |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/danialfarid-angular-file-upload/4.0.2/angular-file-upload.min.js"></script> | |
| <script src="controller.js"></script> | |
| <script src="services.js"></script> | |
| <script src="app.js"></script> | |
| </head> | |
| <body ng-app="myApp"> | |
| <div ng-controller="HomeCtrl"> | |
| {{name}} | |
| {{site}} | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or 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 myAppServices = angular.module('myAppServices', []); | |
| myAppServices.factory('appService', function($http) { | |
| return $http.get("http://www.foo.com"); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment