Reputation: 906
in my directive i have a template like the following
template:'<li ui-sref-active="active" ng-class="\'has\'+ getSubClassString(item)">'+
'<a ui-sref="{{item.state}}">' +
'<span ng-class="getSubClassString(item) + \'-menu-text\'">{{item.content}} </span>' +
'</a>' +
'</li>'
in the ng-class attributes i am trying to concat a string with a function that returns a string, but it doesn't seem to be working, what am i doing wrong?
Upvotes: 2
Views: 9408
Reputation: 5691
Try adding {{ }}
so the function will be called and its result will be calculated instead of having the function name as a string.
Try the following code:
template:'<li ui-sref-active="active" ng-class="\'has\'+ getSubClassString(item)">'+
'<a ui-sref="{{item.state}}">' +
'<span ng-class="{{getSubClassString(item)}} + \'-menu-text\'">{{item.content}} </span>' +
'</a>' +
'</li>'
Upvotes: 4