我正在尝试根据这篇文章创建一个工具提示
Angular-UI-Bootstrap custom tooltip/popover with 2-way data-binding
我成功创建了弹出式窗口,但无法将内容发送到我的popover.html
我将此添加到我的script.js
var app = angular.module('myApp', ['ui.bootstrap', 'ian.bootstrap']);
app.controller('myCtrl', function ($scope) {
$scope.item = {
title: 'Original Title',
content:'content 1' //newly added item
};
$scope.text = 'Click me';
});
我希望在我的popover.html中显示它
<div class="popover-content">
{{item.content}}
</div>
它没有显示任何内容。有人可以帮我吗?非常感谢!
我的傻瓜
答案 0 :(得分:0)
您可以在ng-controller
中添加div
,然后像这样指定控制器名称:
<div class="popover-content" ng-controller='myCtrl'>
{{item.content}}
</div>
答案 1 :(得分:0)
在用例之前,创建自定义指令的基本语法。 对于本页中的所有代码示例,我从angular-seed模板开始。 从angular-seed骨架开始,很容易提取模型以开始实现自定义指令。
<html ngApp="myApp">
...
<div my-first-directive></div>
<script src="lib/angular/angular.js"></script>
<script src="js/app.js"></script>
<script src="js/directives.js"></script>
...
</html>
答案 2 :(得分:0)