Javascript 我想在popover中使用指令,使用角带
我用的是角带。 我想在popover的内容中使用指令。 这是角带bs popover的相关代码:Javascript 我想在popover中使用指令,使用角带,javascript,jquery,twitter-bootstrap,angularjs,angular-strap,Javascript,Jquery,Twitter Bootstrap,Angularjs,Angular Strap,我用的是角带。 我想在popover的内容中使用指令。 这是角带bs popover的相关代码: popover.getPosition = function () { var r = $.fn.popover.Constructor.prototype.getPosition.apply(this, arguments); $compile(this.$tip)(scope); scope.$digest(); this.$tip.data('popover', this);
popover.getPosition = function () {
var r = $.fn.popover.Constructor.prototype.getPosition.apply(this, arguments);
$compile(this.$tip)(scope);
scope.$digest();
this.$tip.data('popover', this);
return r;
};
问题是,第一次popover定位的计算与其他时间不同。
调试后,我注意到第一次应该显示内容的popover没有编译,似乎编译函数中有异步过程。
工具提示是像缓存一样保存的,所以下次打开popover时,内容已经编译好了,我得到了正确的结果