Angular JS, Validation Errors in console

时间:2016-04-04 18:35:14

标签: javascript angularjs validation

Getting error while doing

Note : I cant change the name it should start with 00 due third party dependency. How can I avoid error ?

  <input id="name" data-ng-model="contactInfo.name" name="00xyz"
        type="text" placeholder="" class="form-control" required>
  <p ng-if="(form.00xyz.processed || form.00xyz.$dirty) && form.00xyz.$error.required">name is required</p>

Getting following error:

https://docs.angularjs.org/error/$parse/syntax?p0=.00&p1=is%20unexpected,%20expecting%20%5B)%5D&p2=13&p3=(contactForm.00xyz.processed%20%7C%7C

Error:

Syntax Error: Token '.00' is unexpected, expecting [)] at column 13 of the expression [(contactForm.00xyz.processed ||] starting at [{4}].

1 个答案:

答案 0 :(得分:1)

我认为问题在于输入的名称,因为它以数字开头。

将名称改为像xyz00

或访问表单元素的属性,如

  

ng-if =&#34;(表格[&#39; 00xyz&#39;]。处理过的||表格[&#39; 00xyz&#39;]。$脏)&amp;&amp;形式[&#39; 00xyz&#39]。$ error.required)&#34;