【发布时间】:2017-07-13 05:16:04
【问题描述】:
指令
return {
restrict: 'E',
replace: true,
transclude: true,
require: ['^?angular-redactor', '^?ngModel'],
scope: {
options: '='
},
template: `<div ng-if="options.type=='redactor'">
<textarea
id="{{options.id}}"
ng-model="ngModel"
ng-disabled="!hasPermission('editPageTitle')"
height="{{options.height}}"
style="{{options.style}}"
redactor="{{options.config}}">
</textarea>
</div>`
}
HTML
<txt ng-model="title"
options="{
type: 'redactor',
id: 'title-input',
height: '26px',
style: 'resize:none; max-height: 32px' ,
config: {
minHeight: 37
}
}">
</txt>
我得到的结果是 ng-model="ngModel" 而不是 ng-model="title"。我尝试将模板 ng-model="ngModel" 更改为 ng-model="{{ngModel}}"。但它没有用。不知道为什么。
【问题讨论】:
标签: html angularjs angularjs-directive