I'm trying to create a directive that's used like this:
<amount value=myValue neg-class=negative />
myValue
is a scope value (should be a number)
negative
is simply the name of a css class.
The idea behind the directive is that I wan't to show currency to the user and when the amount that's bound is negative, negClass get's applied to the rendered element.
The problem I'm having is that when negClass is changed, the update doesn't take effect. I do see the changes in the DOM, though.
Here's my directive definition:
myModule.directive('amount', function () {
return {
restrict: 'E',
replace: true,
template: '<span ng-class={ {{negClass}}: value < 0 }>{{value | currency}}</span>',
scope: {
value: =,
negClass: @,
}
};
});
Here's a test harness that demonstrates the problem: https://dl.dropboxusercontent.com/u/1563210/amtdirtest.html