Reputation: 10696
What is the best practive for keeping data in sync (server <=> browser) after creating new record?
e.g. After creating new record (HTTP POST
to server) should I:
Also add new item to the $scope.someArray
Fetch the latest data from the server?
Upvotes: 0
Views: 227
Reputation: 67296
It really depends on your applications consistency requirements. Or if the POST could have effected other things that you might want to refresh.
For the most part, if you have the data, and all you want is the same set of data, save yourself the server call.
BTW, there is a third option that is usually found in REST interfaces:
3 - Send back the latest in response to the POST
.
Upvotes: 1