[英]Way to trigger ngx-bootstrap popover over a link
I want to use ngx-bootstrap popover
over a link, ones I click on that link, a popover will show in the bottom. 我想在链接上使用
ngx-bootstrap popover
,单击该链接后,底部会显示一个弹出窗口。
in ngx-bootstrap website: I found that we can use a Button with a custom template in order to show whatever we want inside that popover this way: 在ngx-bootstrap网站中:我发现我们可以将Button与自定义模板一起使用,以便通过这种方式显示我们想要的内容:
<ng-template #popTemplate>Just another: {{content}}</ng-template>
<button type="button" class="btn btn-warning"
[popover]="popTemplate" popoverTitle="Template ref content inside">
TemplateRef binding
</button>
I'm interested to use this ng-template
example to show in my case user information ones we click on a linked image of that user. 我有兴趣使用此
ng-template
示例来显示我们单击该用户链接图像的用户信息。
So while trying for example this way I'm not able to trigger this popover: 因此,以这种方式进行尝试时,我无法触发此弹出窗口:
<a href="#" role="button" (click)="popTemplate.show()" placement="bottom">
<span>
<img src="urlPhoto"></img>
</span>
</a>
<ng-template #popTemplate>Here we go
name: {{user.name}}
</ng-template>
I'm looking to do something similar to what we have in this question: 我正在寻找与我们在这个问题中类似的东西:
Bootstrap Popover - how add link in text popover? Bootstrap Popover-如何在文本Popover中添加链接?
but using ngx-bootstrap popover. 但是使用ngx-bootstrap popover。
Has someone any idea about the proper way to do this ? 有人对执行此操作的正确方法有任何想法吗?
Currently I've this error in the console: 目前,我在控制台中遇到此错误:
try this code 试试这个代码
<a href="#" [popover]="popTemplate" role="button" placement="bottom">
<span>
<img src="urlPhoto"></img>
</span>
</a>
<ng-template #popTemplate>Here we go
name: {{user.name}}
</ng-template>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.