2017-02-28 59 views
0

所以我有一個md-input和一些按鈕。從mdInput獲得一個值

<md-input-container > 
    <input mdInput #myInput name="myInput" type="password" placeholder="Yeah"> 
</md-input-container> 
<button md-raised-button (click)="authenticate(myInput)">Start</button> 

該按鈕發送整個md-input。我填寫我的輸入,這就是我得到當我點擊按鈕

<input _ngcontent-uqn-44="" mdinput="" name="myInput" placeholder="Yeah" type="password" ng-reflect-placeholder="Yeah" ng-reflect-type="password" class="mat-input-element" ng-reflect-id="md-input-1" id="md-input-1" aria-describedby=""> 

我看不出有任何的屬性/屬性包含我輸入粘貼值。那我怎麼能得到這個價值呢?像myInput.value

+0

你得到任何錯誤?如果是的話更新它的截圖 – Aravind

+0

解決了。不知道問題在哪裏 –

回答

0

我沒有看到您的代碼有任何問題,可能是其他問題引起的問題。

<md-input-container > 
    <input mdInput #myInput name="myInput" type="password" placeholder="Yeah"> 
</md-input-container> 
{{myInput.value}} 

入住這Plunker!