Is there a way to pass variables using attributes to a directive without creating a new scope ?
HTML
&l
I guess you should use compile function in this case.
angular.module('myApp').directive("button", function () {
return {
template: "{{button}}",
replace: true,
scope: true,
compile: function (tElement, tAttrs) {
// this is link function
return function (scope) {
scope.button = tAttrs.button;
};
}
};
});
Here is jsfiddle example.