Reputation: 19178
I want to render /list
after updating the Quiz successfully. How do I do that?
this.update = function() {
Quiz.update($scope.quiz, $routeParams.id)
.success(function() {
// render /list
});
};
Upvotes: 1
Views: 1912
Reputation: 1246
Are you using ngroute or ui-router?
If ngroute
$location.path('/list');
If ui-router
$state.go('stateNameForList');
Upvotes: 1
Reputation: 37701
Well, the sanest solution would be using routing combined with $location, like this:
this.update = function() {
Quiz.update($scope.quiz, $routeParams.id)
.success(function() {
$location.path('/list');
});
};
Of course, it goes without saying that you need to inject $location into your controller, and define the /list
route (I assume you already have this).
Have a look at this is you want additional functionality: https://docs.angularjs.org/api/ngRoute/directive/ngView
Upvotes: 1