I would like to use $parse in angularJS to dynamically create a scope variable which references an array and then push to that array; but $parse's assign method does not seem to do the trick.
$scope.life.meaning = [];
var the_string = 'life.meaning';
// Get the model
var model = $parse(the_string);
Would like to push '42' into the array. So the following won't work:
// Assigns a value to it
model.assign($scope, 42);
Are there any other ways to do this? Thanks.
$scope.life.meaning.push(42)the_stringuntil it is declared programmatically. I just wrote$scope.life.meaning = []so it was clear it would always reference an array.