我们如何在 angular2 或 4 中使用 bootstrap-sweetalert 库?

博士。X

我在我的项目中使用 bootstrap-sweetalert 库。首先我使用下面的代码安装

   `bower install bootstrap-sweetalert --save`

然后我将路径添加到 angular-cli.json 文件

 "scripts"          : [
    "../bower_components/bootstrap-sweetalert/dist/sweetalert.js" 
    ],

在资产目录中有一个styles.css文件,我添加了以下代码

  @import "../../../bower_components/bootstrap-sweetalert/dist/sweetalert.css";

Html 文件为

 <button class="btn btn-circle green-haze btn-outline sbold uppercase mt-sweetalert" data-title="Sweet Alerts with Icons" data-message="Success Icon" data-type="success" data-allow-outside-click="true"
                          data-confirm-button-class="btn-success">Icon Success Alert</button>

但它不起作用!...此外,我在 sweetalert.js 文件中添加了一个 alert() 并且它起作用了!

但是 html 文件不起作用。

有什么办法可以工作吗?谢谢。

轴心

在您的index.html. 我将用简单的引导程序向您展示我的示例。

<link rel="stylesheet" type="text/css" media="screen" href="assets/css/bootstrap.min.css">

这是包含此内容的 index.html:

<app-root>Loading...</app-root>

记住在主库之后导入这个库。

另外,请继续检查文档:

祝你好运和良好的编码!

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

我们如何在iOS中使用LTBouncytextfield库?

将sweetalert2与bootstrap 4一起使用

如何在Angular 2中使用Bootstrap CSS库?

我们如何使用Bootstrap 4使列表组水平

如果我们在angular 4中使用* ngFor,如何在一个实例上触发函数

如何在Angular2中使用bootstrap / jquery

我们是否可以在angular(2/4/5/6)中使用多个库,因为它支持TreeShaking?在不影响性能和构建尺寸的情况下

如何在 Angular 4 中使用 SlickGrid(jQuery 遗留库)

我们应该如何在Function App中使用Azure密钥库?

我们如何在Laravel中使用3个不同的数据库?

如何在最新的 Angular 中使用 bootstrap v4?

如何在 livewire 中使用 sweetalert2

如何在SweetAlert2中使用v-for

Angular2:如何使用pdfmake库

我们如何在IOS的ionic 4中使用铬铸件?

我们如何在 AmCharts4 中使用图例作为过滤器?

我们可以在Bootstrap 4中使用Material UI吗

在Angular 4中使用Bootstrap 4

我如何在 CakePHP4 中使用 sortablejs 库?

如何在Angular2应用程序中使用Bootstrap下拉菜单?

我们如何在Yii2 RBAC中使用auth_rule表?

我们如何在Feathersjs + Apollo v2中使用钩子?

我们如何在cakephp 2中使用任何异步函数或线程

如何在 angular 6 项目中使用来自 sweetalert2 的 InputValidator?

我们如何在一般存储库模式中使用includeProperties来应用条件包含?

我们如何在 Android 中使用 MySQL 数据库值创建多个微调器?

我们如何在同一项目中使用多个Kendo库版本

如何在apachecordova中使用sweetalert?

在 angular 4 中使用 bootstrap 4 或 ng-bootstrap 组件