在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5/ Unexpected 'AppRoutingModule' declared

Unexpected 'AppRoutingModule' declared by the 'AppModule'.

ng2小白
我想搞一個路由,求大神來幫我一把,謝謝?。。。。。。。。?br>git 地址在https://github.com/yyccQQu/ng...

錯誤信息:=》error TS1146: Declaration expected.

==>
compiler.js:485 Uncaught Error: Unexpected module 'AppRoutingModule' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.
clipboard.png

clipboard.png

求大神來幫我一把

clipboard.png

回答
編輯回答
互擼娃

dashboard.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: [ './dashboard.component.css' ]
})

Changed to:

import { Component } from '@angular/core';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: [ './dashboard.component.css' ]
})
export class DashboardComponent {
}

---------------UPDATE----------

圖片描述

2017年7月16日 16:17
編輯回答
茍活

你的DashboardComponent沒有導(dǎo)出任何東西啊

export class DashboardComponent implements OnInit {

    //some code
2017年7月18日 15:28
編輯回答
六扇門

只需要改動App.module.ts中的內(nèi)容,如下:

@NgModule({
  declarations: [
    AppComponent,
    DashboardComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

強(qiáng)調(diào)一點(diǎn),Component在declarations中的,Module在import中的,這樣你就不會出錯了。

2017年9月9日 05:06