I'm trying to add a class to a input tag dynamically depending on a condition, inside a directive. Something like that:
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, model) {
model.$render = function () {
if (verify(model.$modelValue)) {
var elm = getElm(element)
elm.addClass('default');
}
}
}
But if element is an input, then the value is not displayed in the view.
Any guesses about what I'm doing wrong?