问题描述
我采用了棱角分明的UI自举在我目前的项目,我有一个酥料饼的要求给每个行中网格中显示行的具体信息开拓。的酥料饼应该有它自己的HTML模板和存在可以在HTML模板的约束多个字段。这里是code我写来达到同样的。我曾尝试通过HTML模板,没有运气。任何帮助是AP preciated。
I am using angular-ui-bootstrap in my current project, and I have a requirement for a popover to open up in each row in a grid displaying row specific information. The popover should have its own HTML template and there are multiple fields that can be bound in the HTML template. Here is the code I have written to achieve the same. I did try to pass the html template with no luck. Any help is appreciated.
HTML code:
HTML Code:
<div ng-app="helloAngular" ng-controller="casesCntrl">
<table class="table table-bordered">
<thead>
<tr>
<th class="">Date</th>
<th class="">Case</th>
<th class="">Severity</th>
<th class="">Status</th>
<th class="">Site</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="case in cases">
<td>{{case.casedate | date:'MM/dd/yyyy'}}</td>
<td><a ng-href="#/site/{{case.id}}">{{case.name}}</a></td>
<td ng-class="{'case-critical':case.severity==1, 'case-urgent':case.severity==2, 'case-normal':case.severity==3}" class="case-none"></td>
<td>{{case.status}}</td>
<td>{{case.sitename}} <button popover="{{case.sitename}}" popover-title="{{case.sitedescription}}" data-placement="bottom" data-trigger="focus" class="btn btn-default" popover-unsafe-html="This is a Help but please <b> focus </b> on this">V</button></td>
</tr>
</tbody>
</table>
</div>
JS code:
JS Code:
function CasesController($scope) {
var casesData = [
{
"name": "Case -1",
"casedate":"2013-06-26T08:02:00-0700",
"caseid":1,
"severity": "1",
"status":"New",
"siteid":1,
"sitename":"Merchant Demo 1"
},
{
"name": "Case -2",
"casedate":"2013-01-26T08:02:00-0700",
"caseid":2,
"severity": "1",
"status":"New",
"siteid":2,
"sitename":"Merchant Demo 2"
},
{
"name": "Case -3",
"casedate":"2013-02-26T08:02:00-0700",
"caseid":3,
"severity": "1",
"status":"Accepted",
"siteid":1,
"sitename":"Merchant Demo 3"
} ,
{
"name": "Case -4",
"casedate":"2013-05-26T08:02:00-0700",
"caseid":4,
"severity": "2",
"status":"New",
"siteid":1,
"sitename":"Merchant Demo 4"
} ,
{
"name": "Case -5",
"casedate":"2013-09-26T08:02:00-0700",
"caseid":5,
"severity": "3",
"status":"New",
"siteid":1,
"sitename":"Merchant Demo 5"
} ,
{
"name": "Case -6",
"casedate":"2013-04-26T08:02:00-0700",
"caseid":6,
"severity": "1",
"status":"Sent to billing",
"siteid":1,
"sitename":"Merchant Demo 6"
},
{
"name": "Case -7",
"casedate":"2013-10-26T08:02:00-0700",
"caseid":7,
"severity": "3",
"status":"New",
"siteid":1,
"sitename":"Merchant Demo 7"
}
];
$scope.cases = casesData;
}
下面是具有相同code如上所述的小提琴:
Here is the fiddle that has the same code as described above:http://jsfiddle.net/anirbankundu/YyK5s/4/
我曾尝试通过传递酥料饼不安全,HTML如 HTTPS的选项:/ /github.com/angular-ui/bootstrap/pull/641
I did try the option by passing popover-unsafe-html as described in https://github.com/angular-ui/bootstrap/pull/641
推荐答案
要提供一个模板到酥料饼的功能是使用酥料饼模板在UI角版本bootsrap介绍0.13.0 的属性,这个一模板的位置要用于酥料饼体。
http://angular-ui.github.io/bootstrap/#/popover
The functionality to provide a template to a popover is introduced in angular UI bootsrap version 0.13.0 using popover-template attribute which takes the location of a template to use for the popover body.http://angular-ui.github.io/bootstrap/#/popover
这篇关于在角UI酥料饼模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!