I am trying to do use the angular push function but it is not working.
I want to add strings (or objects) into an array.
I searched for basic examples here
Please check this - http://plnkr.co/edit/5Sx4k8tbWaO1qsdMEWYI?p=preview
Controller-
var app= angular.module('app', []);
app.controller('TestController', function($scope) {
this.arrayText = [{text:'Hello',},{text: 'world'}];
this.addText = function(text) {
if(text) {
var obj = {
text: text
};
this.arrayText.push(obj);
this.myText = '';
console.log(this.arrayText);
}
}
});
HTML