-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Passing parent view's state to nested (or children) component view. #35
Comments
Hi, This does not mean that it cannot be done, just that right now the API are not very friendly for accomplishing it. We are moving towards an explicit way of rendering the components as pointed here: #26 This way it would be possibile to pass anything you need to the mounted components (on which you have no control right now since is the UIView thats handles the rendering): <UIView render={(Component, props) =>
<Component {...props} user={this.state.user} />
} /> Since this API change allows for so many things that we cannot do right now I guess I should get it done ASAP 😅 |
Add new `render` function prop API. This new API lets you control how the routed component is rendered by the `UIView`: ```jsx <UIView render={(Comp, props) => <Comp {…props} />} /> ``` BREAKING CHANGE: Rename `Resolves` interface to `UIViewResolves` for consistency. BREAKING CHANGE: Rename `InjectedProps` interface to `UIViewResolves` for consistency. Closes #35 Closes #26 Closes #13
I appreciate your answer. However, It's not working.... Do I have to update the module? I installed ui-router module through npm. Also, using that feature, can I change parent view's state from children view? Then, it will be perfect! |
The example I've shown isn't yet a released API, as it's coming in 0.5.0 which will be released soon. I just need to finish some documentation and we should be good to go. Sorry you have to wait a bit longer. Now sure what you mean, but to change a view state you just need to transition to a new state, and you can trigger transitions from wherever you need, so I'd say yes you can. I'll ping you here once 0.5.0 is out! |
Alright. I am looking forward to seeing new feature!! Again I appreciate your answer. |
@ohpyupi just wanted to mention that it appears this feature has been released. |
yeah, sorry I forgot to update this issue, the feature has been released as @telekid mentioned. Let us know if you need any help! |
Thanks guys! |
It must be very stupid question but I wasn't able to find any sound solution to my question on the web. So I am posting it if I can get help from here.
Basically I want to make nested views. I was able to make nested views. However, I have no idea how to pass parent's state to nested view's component.
I tried below but didin't work
Also, I am curious how parent and child (or nested) views acually communicate in ui-router. Do they follow the typical data flow in react.js? For example, usually I make functions and save data to state in container component (parent) and pass to children component. So technically child components emit events and parent do the actual work responding to the emitted events.
Thanks.
The text was updated successfully, but these errors were encountered: