微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

angular – 如何使用像烤面包机通知这样的ngx-bootstrap创建公共通知

我是角度2&的新手. 4.我想用ngx-bootstrap警报和模态创建自定义通知.我搜索了一些样本.但那些并不简单.我只需要一个简单的蓝图来创建服务,接口和组件的通知.

请任何人用示例代码指导我.

ngx-bootstrap的官方文档 – Alerts.
ngx-bootstrap的官方文档 – Modals.
这里提供的api文档和使用场景以及实际示例.

为了快速参考,我将为您提供一个简单警报框的代码 – 下面的用法和演示:

首先,使用以下方法导入Root模块中的ngx-bootstrap:

import { AlertModule } from 'ngx-bootstrap';

@NgModule({
  imports: [AlertModule.forRoot(),...]
})
export class AppModule(){}

这里是HTML部分模板:

<alert type="success">
  <strong>Well done!</strong> You successfully read this important alert message.
</alert>

组件代码如下:

import { Component } from '@angular/core';

@Component({
  selector: 'demo-alert-basic',templateUrl: './basic.html'
})
export class DemoAlertBasicComponent {}

原文地址:https://www.jb51.cc/angularjs/142011.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐