Last active
May 8, 2016 19:47
-
-
Save ianrodrigues/0ae7b3d87ffb11e90262d400266a82cc to your computer and use it in GitHub Desktop.
This file contains 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
(function() { | |
'use strict'; | |
angular | |
.module('app') | |
/** será <acme-hello-world></acme-hello-world> */ | |
.directive('acmeHelloWorld', acmeHelloWorld); | |
/** @ngInject */ | |
function acmeHelloWorld() { | |
var directive = { | |
restrict: 'E', | |
templateUrl: '/path/to/template.html', | |
controller: acmeHelloWorld, | |
controllerAs: 'vm', | |
link: function(scope, element) { | |
/** adicionei o nome da classe manualmente */ | |
/** mas queria que ele pegasse o nome da diretiva(lá da linha 7) já normalizado */ | |
element.addClass('acme-hello-world'); | |
/** no final minha diretiva ficará: <acme-hello-world class="acme-hello-world"></acme-hello-world> */ | |
} | |
}; | |
return directive; | |
/** @ngInject */ | |
function acmeHelloWorld() { | |
/** some logic here */ | |
} | |
} | |
})(); |
alissonbrunosa
commented
May 8, 2016
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment