[英]How can I send an attribute to my directive with angular?
I am using this HTML for my ckEditor: 我正在为ckEditor使用以下HTML:
<textarea data-ck-editor="text" data-ng-model="modal.data.text"></textarea>
Directive: 指示:
app.directive('ckEditor', [function () {
return {
require: '?ngModel',
link: function ($scope, elm, attr, ngModel) {
var ck = null;
var config = attr.editorSize;
var abc = attr.abc
var def = attr.def
if (config == 'wide') {
ck = CKEDITOR.replace(elm[0], { customConfig: 'config-wide.js' });
} else {
ck = CKEDITOR.replace(elm[0], { customConfig: 'config-narrow.js' });
}
From my HTML, how can I send a value for editorSize, abc and def ? 从我的HTML中,如何为editorSize,abc和def发送值? Could I send this as part of the
我可以将其作为
data-ck-editor="text
您已经完成了主要部分,只需添加诸如
<textarea data-ck-editor="text" data-ng-model="modal.data.text" editorSize="something" abc="something" def="something"></textarea>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.