0
將我的指令綁定到封裝它的控制器中的模型時遇到困難。 ng-model
的值不在指令中。模型的值在渲染後仍保留變量名稱「val」。封裝示波器角度的指令
template:
'<div ng-model="value" id="{{textareaId}}" style="resize:vertical;height:{{textareaHeight || \'80px\'}}; overflow:auto" contentEditable="true" class="{{textareaClass}} wysiwyg-textarea" rows="{{textareaRows}}" name="{{textareaName}}" required="{{textareaRequired}}" placeholder="{{textareaPlaceholder}}"></div>' +
'</div>',
restrict: 'E',
scope:{
value: '=ngModel',
textareaHeight: '@textareaHeight',
textareaName: '@textareaName',
textareaPlaceholder: '@textareaPlaceholder',
textareaClass: '@textareaClass',
textareaRequired: '@textareaRequired',
textareaId: '@textareaId',
},
如何在這種情況下進行綁定。
http://plnkr.co/edit/uAOkmQ?p=info我仍然有點失落 – user3461101