lundi 27 juin 2016

laravel 5 and angular js on form validation

I have installed angularjs 1.5.7 in laravel 5 and i have used gulp to put all my js files in one file including angularjs. my problem comes when i want form validation to work. here is my code

<form  action="/sponsored" name="angularform" id="mpesa_form" method="POST" novalidate  role="form" />           
    <div class="form-group">                    
        <label for="sponsor_name">Sponsor Name:</label>
        <input type="text" name="sponsor_name" id="sponsor_name" class="form-control" value="" ng-model="editable.sponsor_name" required />

        <span ng-if="angularform.sponsor_name.$error.required">Sponsor Name field is Required</span>      
    </div>


    <div class="form-group">
        <button type="submit" class="btn btn-primary">Sponsor</button>  
    </div>
</form>

the way its suppose to work is that when i user insert a letter or a number into the input box, the "Sponsor Name field is Required" error should disappear but in my case its not working.

I have tested the other angularjs functionalities and it works but the variable "$error" which should is suppose to hide the error does not work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire