javascript - Not displaying object item which contains `.` in angularjs -
following json item not displaying in angularjs.
error = { "name": [ "the name field required." ], "salary.salary_id": [ "the salary.salary id field required." ] } when trying display error using angularjs,
{{error.name[0]}} output the name field required.
when trying display second one,
{{error.salary.salary_id[0]}} it display nothing, hope problem . operator placed in key name.
how can solve this?
use [] notation whenever object key contain special characters.
{{error['salary.salary_id'][0]}} when use {{error.salary.salary_id[0]}} value, search key of salary inside error , try find salary_id inside salary key, undefined.
Comments
Post a Comment