I have an AngularJS site, the object-resource I want to show is:
- each user has a basic account, that will show in a single page (named
basic-page); - user has several sub-account, each sub-account will show in a diffent page (named
app-page); basic-pagewill show the summer info about the sub-account, soapp-pagecan share theloaded $http dataofbasic-pageis better for code reusing.
As the purpose, I use ui-router define state below:
.state('user', {
url: '/user/{id}',
title: 'User-Page',
templateUrl: helper.basepath('user.html')
})
.state('user.app', {
url: '/{app}',
title: 'App-Page',
emplateUrl: helper.basepath('app.html')
})
Notice that state user.app is the child of user.
What I want is when I enter the user.app, it can reuse the data in user, ecen if it's a different page, that the user need not to contain a ui-view to include user.app's template.
But actually I enter user.app, and it doesn't show the app.html(because I didn't include ui-view in user.html).
Maybe this is not the correct usage of ui-router.
So, how can I share data in different $state? Anyone can give me a detailed example? Thank you.