Skip to content

Instantly share code, notes, and snippets.

@weslley39
Created November 3, 2016 01:17
Show Gist options
  • Save weslley39/e44a334bbe5559f1ea13449c25556259 to your computer and use it in GitHub Desktop.
Save weslley39/e44a334bbe5559f1ea13449c25556259 to your computer and use it in GitHub Desktop.
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