Á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
shieldModule.service( 'DialogService', function() {
	
	this.visible = false;
    this.isOpen = function() {
		return visible;
	};
 
	this.show = function() {
		this.visible = true;
	};
 
	this.hide = function() {
		this.visible = false;
	};
});
 
shieldModule.controller( 'UserProfileController', [ 'DialogService', '$scope', function( DialogService, scope ) {
	
	// ...
	// ...
 
	// metodo chamado ao clicar no botão link 'Abrir Profile'
	scope.openUserProfile = function() {
		if ( !DialogService.isVisibleisOpen() ) {
			DialogService.show();
		}
	};
	
}]);

...