小编Mat*_*t S的帖子

router-outlet不是已知的元素

以下代码有效:

/*app.module.ts*/
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { LetterRecall } from './letterRecall/letterRecall.component';

@NgModule({
    imports:      [BrowserModule, HttpModule],
    declarations: [AppComponent, LetterRecall],
    bootstrap:    [AppComponent],
})
export class AppModule {}

/*app.component.ts*/
import {Component} from '@angular/core';
@Component({
    selector: 'my-app',
    templateUrl: 'app/app.component.html'
})
export class AppComponent { }

/*app.component.html*/
<h3>Title</h3>
<letter-recall></letter-recall>
Run Code Online (Sandbox Code Playgroud)

遵循Angular Routing Tutorial:https://angular.io/docs/ts/latest/tutorial/toh-pt5.html

我将我的代码修改为:

/*index.html*/
<head>
   <base href="/">

/*app.module.ts*/
import { NgModule } from '@angular/core';
import { HttpModule …
Run Code Online (Sandbox Code Playgroud)

angular2-routing

17
推荐指数
2
解决办法
1万
查看次数

标签 统计

angular2-routing ×1