OK, I'm 1-day new to AngularJS, so this has to be ultra-basic (I hope not an ignorant one about how AngularJS works - I admit MVC is not really my thing, but anyway...).
My Code :
var PP = angular.module('PP', []);
PP.controller('documentController', function ($scope) {
$scope.documents = [
{
'filename': 'Untitled-1',
'content': 'Content-1'
},
{
'filename': 'Untitled-2',
'content': 'Content-2'
},
{
'filename': 'Untitled-3',
'content': 'Content-3'
},
];
});
So, I have declared a module (PP
), with a controller (documentController
) and a property(?) in it (documents
).
So, I have 2 questions :
- How (any possible way is welcome) could I programmatically have access to and change the
documents
array? (insert/remove/etc) - How can I set up an event which fires up when the array has been changed, e.g. an element has been inserted?