I have an application with 2 views\controller:
app.config(function ($routeProvider, $locationProvider)
{
$routeProvider
.when("/", {
templateUrl: "/vw/managment",
controller: 'managment-ctrl'
})
.when("/add", {
templateUrl: "/vw/add",
contoller: 'add-ctrl'
})
.otherwise({
controller: function ()
{
window.location.replace('/errors/filenotfound');
},
template: "<div></div>"
});
$locationProvider.html5Mode(true);
});
The path /
is my "homepage" which show a list of items from DB. In this page the user have button "Add" which redirect the page to /add
. The 'Add' page allow the user to add items from DB. The user is selecting items and click "Save". The "Save" button save the items to DB and redirect back to "homepage".
$scope.save = function()
{
// Save login...
$location.path("/");
};
The problem
After changing the location path, the view change to "homepage" but still showing the items from time before adding the new items. Refreshing the page will solve the problem, but of course it's not the solution...
I guess that the homepage view is being loading from cache. I want to force angular refresh the view.
How to do it?