RapidMod

AngularJs form.$valid debugging script

Feb 13th, 2019
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2. /**
  3.  *
  4.  * to use this script replace "form.$valid" and "form.$error" with the proper model
  5.  * name in the html snippet below
  6.  * IE <my_form_model_name>.$error and <my_form_model_name>.$valid
  7.  * and then place the html snippet inside of the form
  8.  * @packge @angulaJs
  9.  * @author RapidMod.io
  10.  */
  11. ?>
  12.  
  13. <ul ng-if="!form.$valid">
  14.     <li ng-repeat="(key, errors) in form.$error track by $index"> <strong>{{ key }}</strong> errors
  15.         <ul>
  16.             <li ng-repeat="e in errors">{{ e.$name  }} has an error: <strong>{{ key }}</strong>.</li>
  17.         </ul>
  18.     </li>
  19. </ul>
Advertisement
Add Comment
Please, Sign In to add comment