In a state with multiple named views. Each view has its own controller and resolve. Is it possible to reload an individual view in the state? $state.reload will reload the whole state including all views.
-
No, there is not. What is your use case?Chris T– Chris T2014-11-26 19:41:33 +00:00Commented Nov 26, 2014 at 19:41
-
Let's say I have a dropdown list that also serves as a way to pick each user you want to edit. It has a controller and shows the names of the users. Say someone edits their name and save to the repo, I want to information to be reflected in the dropdown list. In that case, i want to refresh the view containing the dropdown list to pull from the server whenever there is an update to the name.xeejem– xeejem2014-11-26 22:24:14 +00:00Commented Nov 26, 2014 at 22:24
-
so you must use your controller fn to go retrieve the values, put them on the $scope, and let the dropdown read from $scope?Chris T– Chris T2014-11-26 23:00:38 +00:00Commented Nov 26, 2014 at 23:00
Add a comment
|
2 Answers
There is a documentation about ui-view.
<div ui-view="main"></div>
$stateProvider.state("main", {
views: {
"main": {
template: "main.html"
}
}
});
This code block will load your view;
$state.go("main", {}, {reload: true});
This can be fired in your view's controller;
1 Comment
Ben George
This will reload the 'main' state. It just so happens you have view + state name the same 'main'.
No it is not possible to reload a single view and leave the others as they were.
You can reload just the current state though if that is what you need. Reload the current state, and only the current state (the key being reload param).
$state.transitionTo($state.current, $stateParams, {
reload: $state.current.name, inherit: false, notify: true
});
1 Comment
Ben George
Single word answer would be appropiate :) ... "NO".