我将 FCKTAG 转换为 INPUT 并附加 dhtmlxcalendar。有用。 指令也可以正常工作。 但我需要将日历附加到带有图标的输入 Initialization of dhtmlxCalendar Doc
Initialization of dhtmlxCalendar Doc : 我必须输入
<span><img id="calendar_icon" src="path.gif" border="0"></span>
在我放置的 Angular 指令中
template: '<input type="text" ng-model="g" ></input>' +
'<span><img src="http://clans.worldoftanks.ru/media/' +
'clans/emblems/cl_582/2582/emblem_24x24.png" border="0"></span>',
这是错误的。我需要一个根标签。我选择DIV:
template: '<div>' +
'<input type="text" ng-model="g" ></input>' +
<span><img src="http://clans.worldoftanks.ru/media/' +
'clans/emblems/cl_582/2582/emblem_24x24.png" border="0"></span>' +
'</div>',
Annnd... 日历未加载。 我不知道为什么。
最佳答案
在您的链接函数中,您使用 element[0] 获取输入元素。一旦将其全部包装在一个 div 标签中,它就不再是元素 [0]。尝试替换以下代码。
var input = element.find('input')[0];
if (myCalendar == null) {
myCalendar = new dhtmlXCalendarObject(input);
} else {
myCalendar.attachObj({input:input, button: input});
}
关于javascript - 带有图标的 Angular 指令和 dhtmlxcalendar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23658897/