I'm getting this error when I updated to the last version of nativescript-angular
, I suppose the problem is related to the difference in the version of Angular 2
I'm using and the one used by the module. Is anyone able to tell me what are the right versions I should use to make it work?
Mind that my intention to upgrade to the last version of nativescript-angular
was to use the RouterExtensions
.
Argument of type 'Route[]' is not assignable to parameter of type 'Route[]'.
Type 'Route' is not assignable to type 'Route'.
Types of property 'pathMatch' are incompatible.
Type 'string' is not assignable to type '"full" | "prefix"'.
Type 'string' is not assignable to type '"prefix"'.
const routes: Route[]
these are my package.json dependencies:
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "0.3.0",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/platform-server": "2.0.0-rc.4",
"@angular/router": "^3.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.4",
"nativescript-angular": "^0.3.1",
"nativescript-plugin-firebase": "^3.5.3",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.6",
"tns-core-modules": "^2.3.0-2016-08-29-3966",
"zone.js": "^0.6.17"
},
the app.routes.ts:
import { RouterConfig } from '@angular/router';
import { nsProvideRouter} from 'nativescript-angular/router';
import { LoginComponent } from './components/login.component';
import { DashboardComponent } from './components/dashboard.component';
const routes: RouterConfig = [
{
path: '',
redirectTo: '/login',
terminal: true
},
{
path: 'login',
component: LoginComponent
},
{
path: 'dashboard',
component: DashboardComponent
}
];
export const APP_ROUTER_PROVIDERS = [
nsProvideRouter(routes, { enableTracing: false })
];
There seems to be no property RouterConfig
exported by @angular/router
. Try using Routes
instead.
const routes: Routes = [ // <==
{
path: '',
redirectTo: '/login',
terminal: true
},
{
path: 'login',
component: LoginComponent
},
{
path: 'dashboard',
component: DashboardComponent
}
];
I just had the same problem, but source of the problem was that package I was using was built with angular 2 and project was built with angular 4. Although, package works with versions 2+ the problem was that method was expecting old (ng2) Routes but was given new (ng4) Routes. Apparently there is a difference.
My solution was to remove type definition as pass my routes as any type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With