gpt4 book ai didi

javascript - 使用 ng-repeat 在 Angular 选项卡中使用 jQuery 插件的多个实例

转载 作者:行者123 更新时间:2023-11-28 07:15:10 24 4
gpt4 key购买 nike

我自己制作了一个自定义 jQuery 插件来创建日历。在我的 Angular 应用程序中,我有多个选项卡,每个选项卡都应包含一个日历实例。

查看.html

<tabset>
<tab ng-repeat="bien in biens" active="$last" >
<div id="calendar_{{bien.ID}}" >
<frontcalendar model-id="{{bien.ID}}"></frontcalendar>
</div>
</tab>

所以我做了一个指令:

frontApp.directive('frontcalendar', function ($parse) {
return {
restrict: 'E',
replace: true,
templateUrl: 'views/calendar.html',
link: function (scope, element, attrs) {

launchCalendar(attrs.modelId);

}
};
});

在views/calendar.html中有

<div class="calendar_container" id="calendar_container_{{bien.ID}}"></div>

我的 jQuery 插件 launchCalendar 就可以做到

$("#calendar_container_"+id_div).html(some_generated_html);

当我在 jquery 插件中记录 DOM 时,它似乎找不到 #calendar_container_{{ID}}...

我哪里失败了?

最佳答案

区分 AngularJS 中的 bien.ID 和 javascript 中的 id_div

我无法解决此问题,因为您没有提供足够的数据。

关于javascript - 使用 ng-repeat 在 Angular 选项卡中使用 jQuery 插件的多个实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30909007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com