2017-03-05 4 views
0

親愛なるStackOverflowのコミュニティを開くwon`t私のコードのsnipetは(私は多くのことをexlucedましたが、私は考えています角度2ダイアログは、私はここにあなたにエラーを与えるbefor私は、angular2ダイアログに問題があり、</p> <p>を

import {Component, OnInit, NgZone, SimpleChanges} from '@angular/core'; 
import {MdDialog} from '@angular/material'; 

import template from './signup.component.html'; 

@Component({ 
    selector: 'signup', 
    template 
}) 
export class SignupComponent implements OnInit { 

    constructor(private router: Router, private zone: NgZone, private formBuilder: FormBuilder, public dialog: MdDialog) { 
    } 
openDialog() { 
     this.dialog.open(DialogOverviewExampleDialog); 
    } 
@Component({ 
    selector: 'dialog-overview-example-dialog', 
    templateUrl: './dialog.html', 
}) 
export class DialogOverviewExampleDialog {} 

signup.component.htmlファイル:

<h3 flex>Just<a (click)="openDialog()">Click here</a></h3> 
彼らは

signup.component.tsファイル)ここで重要なのではないかもしれません210

とdialog.html:

<p>pls work</p> 

私はChromeで、コンソール上でこのエラーが発生します。 DialogOverviewExampleDialog

答えて

1

DialogOverviewExampleDialogコンポーネントが見つかりません部品工場があなたのNgModuleのentryComponentsフィールドに宣言する必要があります。さもなければ、角度コンパイラはこのコンポーネントがどこかに表示されていることを知らないので(セレクタはどのテンプレートでも使われていないので)、コンパイルされません。

+0

これは私が馬鹿になっているかもしれませんが、どこでentryComponentsを見つけることができますか? –

+0

'@NgModule()'に渡されるオブジェクトにあります。これは通常app.module.tsファイルにあります。 –

+0

多くの人に感謝:それは働いた。めっちゃ幸せ –

関連する問題