Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

Bloco de código
themeEclipse
languagejs
titleRegistrando e Utilizando Services
linenumberstrue
fooModule.service( 'fooService', function() {
    this.foo = function() {
		console.log('This is foo service printing bar :)');
    };
});
 
fooModule.controller( 'fooController', [ 'fooService', function( fooService ) {
	
	fooService.foo();
	
}]);

...

Bloco de código
themeEclipse
languagejs
titleRegistrando e Utilizando Factories
linenumberstrue
fooModule.factory('fooFactory', function() {
    return {
      foo: function() {
		console.log( 'This is foo factory printing bar :)' );
      }
    };
});
 
fooModule.controller('fooController', ['fooFactory', function(fooFactory) {
	
	fooFactory.foo();
	
}]);

...

Bloco de código
themeEclipse
languagejs
titleRegistrando e Utilizando Services
linenumberstrue
fooModule.provider( 'fooProvider', function() {
 
	var barName = '';
    this.foo = function() {
		console.log('This is foo service printing ' + barName + ' :)');
    };
 
	this.$get = function () {
        return this;
    };
});
 
fooModule.controller('fooController', ['foo', function( fooProvider ) {
	
	fooProvider.foo();
	
}]);

...

Bloco de código
themeEclipse
languagejs
titleRegistrando e Utilizando Services
linenumberstrue
fooModule.config( [ 'fooProvider', function( fooProvider ) {
	
	fooProvider.barName = 'Bar';
	
}]);

Âncora
what-is-directive
what-is-directive

...