是否可以在組件中使用ng-model?我想用一個ng-model將一個範圍變量綁定到一個組件。我有plunkered my issue。我希望將組件my-input綁定到範圍userData.name中的變量。ng-model的角度1.5組件
我正在使用Angular JS 1.5.6組件,並且希望避免使用指令。
<body ng-controller="MyCtrl">
<div class="container">
<h2>My form with component</h2>
<form role="form">
<div class="form-group">
<label>First name</label>
<my-input placeholder="Enter first name" ng-model="userData.name"></my-input>
</div>
</form>
</div>
</body>
它的工作感謝名單了很多很細!我會有最後一個問題。請問,當你有一個由按鈕和輸入組件組成的表單組件時,如何綁定數據:請參閱這個新的[plunk](http://plnkr.co/edit/jLnrDeledkkJBLaKWKjZ) – Mouss