Kee*_*uva 1 twitter-bootstrap typescript angular6
我试图在我的项目中添加模态,以便如果我单击一个链接,模态应显示该特定链接的名称。
但这给我一个错误
请检查下面的链接
最好使用引导程序的角度版本来执行此操作,这与角度变化检测配合使用效果很好。
例如https://ng-bootstrap.github.io/#/components/modal/examples
然后,您将有一个组件代表您的模态,并将数据传递给它,只需声明公共属性并执行以下操作:
const modalRef = this.modalService.open(YourModalComponent);
(modalRef.componentInstance as YourModalComponent).yourProperty = yourValue;
Run Code Online (Sandbox Code Playgroud)
顺便说一句来解决您正在谈论的错误,您可以使用attr属性绑定,如下所示:
<button type="button" class="btn btn-primary" data-toggle="modal" [attr.data-target]="'#' + products.name">
Run Code Online (Sandbox Code Playgroud)
它将修复错误,但是模态仍然不起作用,看起来您在那里也缺少CSS。
| 归档时间: |
|
| 查看次数: |
14376 次 |
| 最近记录: |