0
私はAngular4でデモプロジェクトを1つ実装していますが、これもまた新しくなっています(Angular4)。私は1つのリンクAngular2 module has no exported memberを見ましたが、私はこの問題を解決することができません。Angular4 giveにエクスポートされたメンバがありません(コンパイルに失敗しました)
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { VideoListComponent } from './training/video-list.component';
import { HomeComponent } from './training/home.component';
import { AddVideoComponent } from './training/add-video.component';
import { AboutusComponent } from './training/aboutus.component';
@NgModule({
declarations: [
AppComponent,
VideoListComponent,
HomeComponent,
AddVideoComponent,
AboutusComponent
],
imports: [
BrowserModule,
HttpModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forRoot([
{path: 'home', component:HomeComponent},
{path: 'videos', component:VideoListComponent},
{path :'newvideo',component:AddVideoComponent},
{path: 'aboutus', component:AboutusComponent},
{path: '', redirectTo:'home',pathMatch:'full'},
{path: '**', redirectTo:'home',pathMatch:'full'}
])
],
bootstrap: [AppComponent]
})
export class AppModule { }
aboutus.component.ts
import { Component } from '@angular/core';
console.log('It works here');
@Component({
moduleId: module.id,
templateUrl: 'aboutus.html'
})
export class AboutusComponent {
s: string = "Hello";
constructor() {
console.log(this.s)
}
}
私は失敗したコンパイル与えているよりも、AboutusComponentを追加します。
私はそれが私に(下のスクリーンショットで)ブラウザでいくつかのエラーを与える
私はangular4 に新しいモジュールを追加したい、あなたのアイデアを共有してください。
でなければなりません。デフォルトは 'ng-component'です – yurzui
@yurzuiこれは間違っているかもしれませんが、私はidセレクタはオプションではありません。画像に私の目をとらえるものは何もありません –
彼のタブhttp:// takeを見てください。 ms/BpSuW彼はファイルを保存していないようだ。 – yurzui