2017-04-19 44 views

回答

0

這是可能的。

@Component({ 
    selector: 'app-cmp2', 
    template: 'cmp2' 
}) 
export class Cmp2 { } 

@Component({ 
    selector: 'app-cmp1', 
    template: 'cmp1<br /><button (click)="openDlg()">open second</button>' 
}) 
export class Cmp1 { 

    constructor(public mdDialog: MdDialog) { } 

    public openDlg() { 
    this.mdDialog.open(Cmp2); 
    } 
} 

@Component({ 
    selector: 'material-app', 
    templateUrl: 'app.component.html' 
}) 
export class AppComponent { 

    constructor(http: Http, public mdDialog: MdDialog) { } 

    public openDlg() { 
    this.mdDialog.open(Cmp1); 
    } 
} 

http://plnkr.co/edit/ywuCW8HbsXF7To578mcX?p=preview

也許創建plunker來證明你的問題..

遞歸開口道:http://plnkr.co/edit/XW2VpNvieARV40g77Rps?p=preview

背景疊加只是不斷越來越暗.. :)

相關問題