All the documentation I can find talks about the view automatically updating the model. However, using the example controller:
var phonecatApp = angular.module('phonecatApp', []);
phonecatApp.controller('PhoneListCtrl', function ($scope) {
$scope.phones = [
{'name': 'Nexus S',
'snippet': 'Fast just got faster with Nexus S.',
'age': 1},
{'name': 'Motorola XOOM™ with Wi-Fi',
'snippet': 'The Next, Next Generation tablet.',
'age': 2},
{'name': 'MOTOROLA XOOM™',
'snippet': 'The Next, Next Generation tablet.',
'age': 3}
];
$scope.orderProp = 'age';
});
Within JavaScript, how would I (for example) change phones to an empty array? Basically I would like to do
$scope.phones = [];
(and have the view update automatically) but I can't figure out how to 'get to' the phones variable