nativescriptのクイック・スタート・デモをangular2で実行しようとしています。私がルータに来ると、それは失敗するようになりました。エラーメッセージ:RouterOutletMapのプロバイダがありません!Nativescript Angular2 Route Provider
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router-deprecated/ns-router-deprecated";
:ここはhereは、あなたがこのよう"nativescript-angular/router-deprecated/ns-router-deprecated"
からNS_ROUTER_DIRECTIVES
、NS_ROUTER_PROVIDERS
をインポートする必要があり nativescript githubの問題に解決策として
main.ts
#############
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {ROUTER_DIRECTIVES,ROUTER_PROVIDERS} from '@angular/router-deprecated';
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router";
import {AppComponent} from "./app.component";
nativeScriptBootstrap(AppComponent, [ROUTER_PROVIDERS]);
と
app.component.ts
############
import {Component} from "@angular/core";
import {nativeScriptBootstrap} from "nativescript-angular/application";
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from '@angular/router-deprecated';
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router";
import {FirstComponent} from "./first.component";
import {SecondComponent} from "./second.component";
@Component({
selector: 'navigation-test',
providers: [NS_ROUTER_PROVIDERS],
directives: [NS_ROUTER_DIRECTIVES],
template: `<page-router-outlet></page-router-outlet>`
})
@RouteConfig([
{ path: '/first', component: FirstComponent, name: 'First', useAsDefault: true },
{ path: '/second', component: SecondComponent, name: 'Second' },
])
export class AppComponent { }
たTHX BRO、下記魔法のように!! @ハビカケゼミ – yeulucay