Closed
Description
Upgraded my app to Angular 4 today and am receiving this error when tns run ios
: No provider for PageRoute.
page.json dependencies:
"dependencies": {
"@angular/common": "4.0.1",
"@angular/compiler": "4.0.1",
"@angular/core": "4.0.1",
"@angular/forms": "4.0.1",
"@angular/http": "4.0.1",
"@angular/platform-browser": "4.0.1",
"@angular/platform-browser-dynamic": "4.0.1",
"@angular/router": "4.0.1",
"@ngrx/core": "1.2.0",
"@ngrx/store": "2.2.1",
"nativescript-advanced-webview": "1.1.3",
"nativescript-angular": "1.5.1",
"nativescript-camera": "0.0.8",
"nativescript-google-analytics": "^0.3.5",
"nativescript-imagepicker": "2.5.1",
"nativescript-iqkeyboardmanager": "1.0.1",
"nativescript-social-share": "1.3.2",
"nativescript-telerik-ui": "1.6.2",
"reflect-metadata": "~0.1.8",
"rxjs": "5.3.0",
"tns-core-modules": "2.5.2",
"zone.js": "0.8.4"
},
"devDependencies": {
"@angular/compiler-cli": "4.0.1",
"@ngtools/webpack": "1.2.10",
"babel-traverse": "6.23.1",
"babel-types": "6.23.0",
"babylon": "6.16.1",
"copy-webpack-plugin": "~3.0.1",
"extract-text-webpack-plugin": "~2.0.0-beta.4",
"lazy": "1.0.11",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-android-snapshot": "0.0.8",
"nativescript-dev-typescript": "0.4.2",
"nativescript-dev-webpack": "^0.3.6",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~1.6.0",
"tns-platform-declarations": "2.5.2",
"typescript": "2.1.5",
"webpack": "2.2.0",
"webpack-sources": "~0.1.3"
},
tns doctor
shows no issues.
Removed node_modules, platform, & hooks folders, npm cache clear
, npm install
, and re-ran, but still same error.
In my component:
import { PageRoute } from "nativescript-angular/router";
&
constructor(... private pageRoute: PageRoute, ...) {
...
// Using pageRoute.activatedRoute to trigger updating of multi-board view if a board cover was added to a new board
this.pageRoute.activatedRoute
.switchMap(activatedRoute => activatedRoute.params)
.forEach((params) => {
...
}
});
}
This worked Angular 2.4.8 & nativescript-angular 2.4.1.