122
rated 0 times
[
123]
[
1]
/ answers: 1 / hits: 51151
/ 11 Years ago, sat, december 28, 2013, 12:00:00
I am trying to pass a $scope's variable to a directive, but its not working. I am catching the variable in the template function:
app.directive('customdir', function () {
return {
restrict: 'E',
template: function(element, attrs) {
console.log(attrs.filterby);
switch (attrs.filterby) {
case 'World':
return '<input type=checkbox>';
}
return '<input type=text />';
}
};
});
What I need is the value of variable filterby
not the variable name itself.
More From » angularjs