I am trying to add a read border around the drop-down if the user hasn't selected any valid value. Can I get some advice about this ?
I think the normal 'required' attribute didn't work due to some overlay. So I am trying to use a directive.
directive('stylevalidate', function ($compile) {
return {
restrict: 'A',
link: function (scope, element, attrs,ngModel) {
if (!element.attr('required')){
element.attr("required", true);
console.log('Styling the validation [' + element + ']');
element.addClass('red');
$compile(element)(scope);
}
}
};
})