I am working on an app with custom form controls which need to be validated before clicking a Next button. For standard HTML form controls, angular's built-in validation is quite nice, allowing me to bind my Next button with a ng-disabled on the form.$valid value. However, I am having trouble getting custom validation working in a rather difficult control. Here is my situation:
- I have a custom directive for my form control (a component called
mySlider) mySliderwraps a 3rd-party component angular-slider -- yes, I know it's deprecated- We want to validate that the user has clicked the slider. The Next button should not be enabled if the user has not clicked the slider control.
- I tried to create this custom validation by adding a
has-changedattribute to the 3rd party directive element, and updating it on-click, however it does not seem to be working as expected. - I tried to examine how the built-in validations work (ex: try searching for
var requiredDirective), as well as reading the Angular Forms Guide but it's still a little unclear - We have a requirement to not use jQuery, jQuery UI/Mobile etc, however it must also work for mobile touch events
See my Plunk and help
- please fork if you're going to edit. The custom validator and custom Slider directive is in script.js while the 3rd-party directive is in angular-slider.js.