使用元素的id作为HTML选项删除所有的JavaScript绑定。让他们使用DOM元素。您还应该追加连接控制器的元素。
<!-- Add ID to the controller div -->
<div ng-controller="FrameController as vm" id="controller">
您还需要从模板html中删除display: none;
。从documentation:
如果要将模板的内容克隆到工具提示中,请在html设置中指定模板的ID。否则使用DOM元素本身,它允许你保持监听器连接。如果您使用DOM元素选择,请确保它不隐藏显示:none ;.
然后你对JavaScript的毛尖应该是:
setTimeout(function() {
angular.bootstrap(document.getElementById('body'), ['app']);
tippy('.tippy', {
position: 'bottom',
animation: 'fade',
arrow: true,
interactive: true,
/* The following 2 lines are new */
html: document.getElementById('my-template-id'),
appendTo: document.getElementById('controller')
})
});
什么AngularJS“的特点是你想实现? – ryanpcmcquen
@ryanpcmcquen任何,在小提琴和图像你可以看到,它不能显示消息。 – Shank