Closed
Description
This is a:
- Bug Report
- Feature Request
- General Query
My version of UI-Router is: 1.0.11 ng1
Feature Request
Would be nice to have an access to list of mounting elements (uiViews) corresponding to state, possibly through existing views()
API.
Code below is an example what can be achieved right now but contains some downsides (but illustrate the idea behind this):
- Search is done through all document (its not state context aware like
views()
) - Search is done on every invoke
- Supports only one view (How to query for a proper element using
views()
data?)
$transitionsProvider.onStart({
from: 'a.*',
to: 'a.*'
}, (transition) => {
const fromState = transition.from();
if (typeof fromState.template === 'string') {
// Returns as an exmaple "my-directive" it will looks different with components case
const elementName = getElementNameFromTemplate(fromState.template);
// There is no way to find proper uiView element as a root
const elementInsideSomeUiView = angular.element(document).find(elementName);
// Do anything with element
}
});
General Query
-
I have already asked my question on StackOverflow and nobody could answer the question
Found this one: https://stackoverflow.com/questions/28234260/how-can-i-get-a-reference-to-the-target-element-with-ui-view-attribute-in-ui-rou -
I have already reviewed the sample application for examples of common approaches
-
I believe my question can only be answered by the UI-Router maintainers
Described in Feature Request.
Metadata
Metadata
Assignees
Labels
No labels