例如我有这个文件
<!-- index.tpl.html -->
<span ng-repeat="d in data" ng-controller="clickMe">
<a href="#" class="click-me" data-data="{{d.data}}">{{d.id}}</a>
</span>
<!-- popover.tpl.html -->
<form>
<div ng-switch="data.option">
<div ng-swith-when="one">One</div>
<div ng-swith-when="two">Two</div>
<div ng-swith-when="three">Three</div>
</div>
</form>
这个JS代码
angular.module("myApp").controller("clickMe", ["$scope", function($scope){
$scope.data = [
{id: 1, data: {option: 'one'}},
{id: 2, data: {option: 'two'}},
{id: 3, data: {option: 'three'}},
];
}]);
我也有活动
$(document).on("click", ".click-me", function(){
$(this).popover({
title: "Click Me",
content: "/** How can I render template `popover.tpl.html there?` **/"
});
});
我试图使用指令,但也没有任何效果。我做错了什么?