I'm trying to make a simple directive in angularJS for example.
This is a button that receives the class name and text, as follows:
var app = angular.module('app', [])
.controller('appController', ['$scope', function($scope) {
$scope.alertar = function() {
alert('alertando');
}
}])
.directive('botao', function() {
return {
restrict: 'E',
templateUrl: 'js/diretivas/botao.html',
scope: {
classe: '=',
texto: '='
}
};
});
Inside botao.html, I have:
<button class="{{ classe }}">{{ texto }}</button>
I call the directive in index.html as follows:
<botao classe="btn" texto="Teste"></botao>
What am I doing wrong? The button appears, but without the class and without the text.