I asked Would "@angular/router": "3.0.0-beta.1" work with beta.10 yesterday. And here is what I tried
package.json
"@angular/router": "3.0.0-beta.2",
app/routes.ts
import { provideRouter, RouterConfig } from '@angular/router';
import { DetailPage } from './pages/detail/detail';
export const routes: RouterConfig = [
{ path: 'detail', component: DetailPage },
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
index.html
<base href="/">
app.ts
import {APP_ROUTER_PROVIDERS} from './routes';
ionicBootstrap(MyApp, [APP_ROUTER_PROVIDERS], {});
In another page
import {ROUTER_DIRECTIVES} from '@angular/router';
template: `<a [routerLink]="['/detail']"`>Go detail</a>
directives: [ROUTER_DIRECTIVES]
Basically I followed https://angular.io/docs/ts/latest/guide/router.html
But it doesn’t work, there’s an error in the console when I issue ionic serve
, I’m still trying to figure it out why.