【问题标题】:Way to trigger ngx-bootstrap popover over a link通过链接触发 ngx-bootstrap 弹出窗口的方法
【发布时间】:2018-10-05 10:22:16
【问题描述】:

我想在一个链接上使用ngx-bootstrap popover,我点击那个链接,底部会显示一个弹出框。

在 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>

我有兴趣使用这个ng-template 示例在我的案例中显示用户信息,我们点击该用户的链接图像。

因此,例如以这种方式尝试时,我无法触发此弹出框:

<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>

我正在寻找类似于我们在这个问题中所做的事情:

Bootstrap Popover - how add link in text popover?

但使用 ngx-bootstrap 弹出框。

有人知道正确的方法吗?

目前我在控制台中有这个错误:

【问题讨论】:

标签: angular hyperlink ngx-bootstrap ngx-bootstrap-popover


【解决方案1】:

试试这个代码

<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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-07
    • 2017-11-25
    • 2020-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-21
    相关资源
    最近更新 更多