user2936008
user2936008

Reputation: 1347

Angular JS, Validation Errors in console

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}].

Upvotes: 0

Views: 49

Answers (1)

Sujeet Jaiswal
Sujeet Jaiswal

Reputation: 1089

I think the problem is with the name of the input as it is starting with a number.

Either change the name to someting like xyz00

Or access the form element's attributes like

ng-if="(form['00xyz'].processed || form['00xyz'].$dirty) && form['00xyz'].$error.required)"

Upvotes: 1

Related Questions