What's the correct way to update a ui-router view when state parameters change?
For example, if I've got a state like:
.state("page.view", { url: "/pages/:slug", views: { "": { controller: "PageCtrl", templateUrl: "page-view.html", }, }, }) And an (incorrect) controller which looks like this:
.controller("PageCtrl", function($scope, $state) { $scope.page = loadPageFromSlug($state.params.slug); }) How can I correctly load a new $scope.page when the $state.slug changes?
Note that the above does not work when moving from page to another because the controller is only run once, when the first page loads.