angular-selectize
angular-selectize copied to clipboard
Doesn't trigger ng-touched
After the selectize input has been touched by the user (and a blur event triggered for the first time), it should be given the ng-touched
css class and form.field.$touched
should be set to true.
I've currently hacked this in using onblur
, but would be great if it was fixed properly :)
#58 think these might be related
Have the same issue PaddyMann can you detail how you hacked this using onblur ? Do you mean jquery ?
Ok figured it out! Here is what I did based on PaddyMann comment :
$scope.mySelectizeConfig = {
// config options here
onInitialize: function (selectize) {
selectize.on('blur', function () {
selectize.$control.addClass('ng-touched');
});
},
};
Would be nice to have it fixed though :-)
Add this to the directive to set touch:
settings.onBlur = function(){
selectize = element[0].selectize;
if (scope.config.onBlur) {
scope.config.onBlur(selectize);
}
scope.$apply(function(){modelCtrl.$setTouched();});
}