No provider for RouterOutletMap! {NS} 2.1.0
See original GitHub issueHi,
I recently upgrade to v2.1.0 and started a new App.
I think there is a bug with the Angular router or maybe the NS_ROUTER_PROVIDERS. Here is the error when i run
tns run android
on my Nexus 5x:
JS: EXCEPTION: Error in ./AppComponent class AppComponent - inline template:0:0
JS: ORIGINAL EXCEPTION: No provider for RouterOutletMap!
Here is my Code:
main.ts:
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {AppComponent} from "./app.component";
nativeScriptBootstrap(AppComponent);
and my app.component.ts component :
import {Component} from "@angular/core";
import {RouteConfig} from '@angular/router-deprecated';
import {HTTP_PROVIDERS} from "@angular/http";
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from 'nativescript-angular/router';
import LoginPage from './components/login/login.component';
@Component({
selector: "my-app",
directives: [NS_ROUTER_DIRECTIVES],
providers: [NS_ROUTER_PROVIDERS, HTTP_PROVIDERS],
template: "<page-router-outlet></page-router-outlet>"
})
@RouteConfig([
{ path: '/Login', component: LoginPage, name: 'Login', useAsDefault: true}
])
export class AppComponent { }
the package.json dependencies :
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/platform-server": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.2",
"nativescript-angular": "0.2.0",
"tns-core-modules": "^2.1.0"
},
I remember having the same problem with ng2 a few months ago and solve it by declaring the providers in the bootstrap function of the main.ts file like this:
bootstrap(AppComponent, [
NS_ROUTER_DIRECTIVES,
NS_ROUTER_PROVIDERS
])
But still doesn’t work… Regards
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
No provider for RouterOutletMap - angular - Stack Overflow
How I tried to fix this. I tried to add RouterOutletMap to providers in AppModule, exception don't throw, but app don't redirect to...
Read more >Incident Response - Hybrid Analysis
Submit malware for free analysis with Falcon Sandbox and Hybrid Analysis technology. Hybrid Analysis develops and licenses analysis tools to fight malware.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try import
NS_ROUTER_DIRECTIVES
,NS_ROUTER_PROVIDERS
from"nativescript-angular/router-deprecated/ns-router-deprecated"
This was a breaking change we made in the
0.1.7
. If you are using the@angular/router-deprecated
you should also use thenativescript-angular/router-deprecated
.