javascript array push in angularjs not working - Cannot read property 'push' of undefined -


i work objects, wanted push data array

i don't see why not working angularjs 1.5 , works on jsfiddle site found on

vm.question.qda = []; 

button click event calls code below

vm.question.qda.push(                 {                     "today":null,                     "day2":4,                     "day3":null,                     "day4":null,                     "day5":null,                     "day6":null,                     "day7":null,                     "title":"queries built",                     "id":null                 }); 

error:

  angular.js:14199 typeerror: cannot read property 'push' of undefined 

you need declare qda. , de push

vm.question= {qda:[]};  vm.question.qda.push(             {                 "today":null,                 "day2":4,                 "day3":null,                 "day4":null,                 "day5":null,                 "day6":null,                 "day7":null,                 "title":"queries built",                 "id":null             }); 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -