Answer the question
In order to leave comments, you need to log in
Restangular how data update works?
recently started learning angular , started using this: https://laravel-angular.readme.io
the essence of the question is this: there is a page for adding news, and there are pages with a list of news. How to make it so that when adding news, the news list is updated without page updates.
There are 2 ways:
1) update in the component, when news is added
2) there is some kind of synchronization with the backend directly in the news list component (and it is, but I’m dumb and I don’t understand how to do all this)
Answer the question
In order to leave comments, you need to log in
// отправляем запрос на добавление новости
service.addItem(request).then(function (response) {
// в ответ получаем добавленную новость
// и добавляем ее к массиву новостей
$scope.items.push(response.data);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question