Abstract state in Angular 2?
Hi,
Is it possible to define abstract states in Angular 2 yet? Any example would be highly appreciated.
Thank you.
Is it possible to define abstract states
yep. http://angular-ui.github.io/ui-router/1.0.0-alpha.5/interfaces/ng2.ng2statedeclaration.html#abstract
Sorry, I've missed that page somehow. Very exciting to see my favorite router to retain the cool features in ng2.
I'm migrating from UI-Router Angular 1.5 to Angular 2, and the root abstract state is not working as it's used to be.
I have a root named view, let's call it (main@)
@Component({
selector: 'app',
styles: [
],
template:
<div ui-view="main" class="tw-view tw-column">
<div layout="column" layout-align="center center">
<div>loading ui-view...</div>
</div>
</div>
})
Registration:
UIRouterModule.forRoot({
states: [
{
name: 'app',
abstract: true,
views : {
'main@': AppMainPage,
'toolbar@app': AppToolbar,
'navigation@app': AppNavigation,
'quickPanel@app': AppQuickPanel
}
},
The AppMainPage is never initialized if I provide {views} option.
The same approach is working with UI-Router for Angular 1.5.
Please advise if it's supported in NG2 module.