2
以下のコードでは、入力フィールドのng-model
プロパティをthis.test
変数にリンクします。フォーム - インラインテンプレートからコントロールプロパティにアクセスする方法
class NewComponent {
constructor() {
this.test = 'test';
this.fields = [
{
template:
'\
<div class="form-group">\
<input ng-model="test" type="text" class="form-control">\
</div>\
'
}
]
}
}
angular.module('app')
.component('NewComponent', {
templateUrl: 'new.html',
controller: NewComponent,
controllerAs: 'New'
});
私は何も.... $ctrl.test
とNew.test
を試していません!
[2(ngModel)]とangular1.5を使用してから$ ctrl.test – varit05
を使ってください。私は$ ctrlを試しましたが、うまくいきません...いくつかのコードを追加しました... – Mika
このフィドルを見てください:https://plnkr.co/edit/eeUULQ1YrLhsQvSuA0fD?p=preview – varit05