這是非常複雜添加這個新的對話框,這是我不能夠添加自己的唯一部件。使用對話是非常複雜的
- 我不知道如果我需要的東西添加到我的app.module.ts
- 如何創建這個對話框?我真的不明白有很多信息Dialogreference
我需要設置一次嗎?在我的根組件或什麼?因爲它不起作用,我可以將它添加到我的構造函數中,一旦我有「沒有提供者MdlDialogReference」一旦我有「沒有所有參數(?)」。
實際代碼:
FILE app.component.ts
constructor(private vcRef: ViewContainerRef,
private dialog: MdlDialogReference, private dialogService: MdlDialogService, private httpService: HttpService, private communicationInsideServices : CommunicationInsideServices, private activatedRoute : ActivatedRoute, private router : Router) {
}
get viewContainerRef() {
return this.vcRef;
}
有沒有錯誤?因爲這不會加載我的應用程序,我怎樣才能將這個對話框調入另一個子組件?
你爲什麼要添加MdlDialogReference的依賴?你想把你的appcomonent作爲dialogcontent嗎? – michael
非常感謝,我不知道是什麼MdDialogReference,不,我不想要的應用程序組件作爲我dialogcontent,我需要的東西導入到我app.mobule.ts那裏是我的引導ngModule得到這個對話框的作品?因爲它不會工作或我使用的是錯誤的話,如果你有一個明確plunkr演示,這是值得歡迎的 – istiti
清潔我的所有代碼和中庸之道添加到我的成分在我的構造函數: '構造函數(私人dialogService:MdlDialogService )' 和ngAfterViewInit '讓結果= this.dialogService.alert( '這是一個簡單警報'); result.then(()=> console.log('alert closed'));' 我得到這個錯誤 'TypeError:無法讀取未定義的'parentInjector'屬性 – istiti