Good day, studying the work with resources in angular, came across the following code:
var News, //Ресурс newsInstance; //Экземпляр новости function updateNewsItem(){ newsInstance.published = false; newsInstance.$save(); } News = $resource('/api/news/:id/'); newsInstance = News.get({id: 3}, updateNewsItem); //Новость с id = 3, просто для примера
I don’t understand how to call $ save () without prior declaration.