I have an array of strings, I use this code to add a new item
$scope.list.push(name);
But I don't want to add only the name, I want to do something like
$scope.list.push(data); // data contain name and age
How can I create data object ?
just write
var data = {name : "sampleName", age : 18};
$scope.list.push(data);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With