Created
November 3, 2016 01:17
-
-
Save weslley39/e44a334bbe5559f1ea13449c25556259 to your computer and use it in GitHub Desktop.
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 insideProps = [] | |
var module = function(moduleName) { | |
return { | |
controller: function(controllerName, injections) { | |
var scope = {}; | |
injections[2](scope, insideProps[0].scope); | |
insideProps.push({ | |
name: controllerName, | |
scope: scope | |
}) | |
}, | |
service: function(serviceName, injections) { | |
var scope = injections[1](); | |
insideProps.push({ | |
name: serviceName, | |
scope: scope | |
}) | |
} | |
} | |
} | |
module('firstApp') | |
.service('firstService', [, function(){ | |
return { | |
callMyName: function(name) { | |
console.log(name); | |
} | |
} | |
}]) | |
module('firstApp') | |
.controller('firstController', ['$scope', 'firstService', function($scope, FirstService) { | |
$scope.sayHello = function() { | |
console.log('Hello'); | |
} | |
FirstService.callMyName('Weslley') | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment