2017-04-24 43 views
0

我需要一個彈出屏幕上點擊的角度2.彈出式屏幕將包括不同的標籤,並形成我試着用angular2模態,但它只有及時警覺,但不知道是否支持自定義表單創建。角2彈出窗體上單擊

如果angular2模型支持自定義表單怎麼做其它的東西,它支持去實現我的任務的任何其他包。

我的代碼:

***users.component.html*** 

<input type="checkbox" name="scheduler2" (click)="helpWindow($event)"> 


***users.component.ts*** 

helpWindow(event) { 
    this.modal.alert() 
     .size('lg') 
     .isBlocking(true) 
     .keyboard(27) 
     .showClose(true) 
     .title('A simple Alert style modal window') 
     .body(` 
      <h4>Alert is a classic (title/body/footer) 1 button modal window that 
      does not block.</h4> 
      <b>Configuration:</b> 
      <ul> 
       <input type="text" name="text" /> 
      </ul>`) 
     .open(); 
    } 

回答

0

這是angular2模態開功能:

/** 
    * Opens a modal window inside an existing component. 
    * @param content The content to display, either string, template ref 
or a component. 
    * @param config Additional settings. 
    * @returns {Promise<DialogRef>} 
    */ 
    open(content: ContainerContent, config?: OverlayConfig): 
    Promise<DialogRef<any>> {... } 

正如你看到的,你可以提供一個裁判模板或自定義模式的組成部分。 有關詳細信息,請參見bootstrap-demo-page

+0

我已經開始使用它,它工作正常。我有一個小的查詢如何減少或增加彈出窗口的寬度。 – suresh

0

可以使用angular2材料。它提供了一個很好的對話框,您可以在其中注入任何組件,並且該組件將顯示在該模型中。它還附帶了很多不錯的功能,如afterClose(訂閱者)。您可以將數據傳遞給其子組件。