javascript - Cannot read property push of null -


For the first time pushing for a child array, which is zero, I am getting this error "property Can not read the push of the tap "But the element is pushed, and for the second time I am completely cured. It is added to the array

  this.group.departmentsList.push ({name: group.newCategoryName, sort order: group.partners list. Lamp, type: "category"});   

The group contains the data and the department list is the original array that has been declared as:

  $ scope.parentDepartment = [[List of departments : [[}]}];    

Does not push well into any non-existent array? You can test clearly whether it is not empty and can be made if necessary: ​​

  this.group.departmentsList = this.group.departmentsList || []; This.group.departmentsList.push ({name: group.newCategoryName, sortOrder: group.departmentsList.length, type: "category"});    

Comments

Post a Comment

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -