Form validation with default value


#1

Mabye I am not sure how to word the question so I was unable to find an answer. How can i specify default values for form validation? ie: if the default value is not changed validation fails.

for example, on a dropdown list, how do i show that the field is invalid if the value is -1?

ie:

    <label class="item item-input validated item-icon-right mobile-combo">
        <select class="item-input width-100" ng-model="vm.expireMonth">
            <option value="-1">Month</option>
            <option value="01">January</option>
            <option value="02">February</option>
        </select>

Thanks :smile:


#2

the simple answer is doing if statement after submit
also check this docs in angular site

https://docs.angularjs.org/guide/forms


#3

Validation in js was my option if ionic didnt have something out of the box - I was hoping they just had a input-default="-1" or something but I guess not.

Thank you for the reply :smiley:


#4

its more angular then ionic and u can do something like this. and u welcome :smile: