百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
N

ngx-toastr

> 前端框架
开源

Angular Toastr

2.6K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Angular Toastr

示例: https://ngx-toastr.vercel.app

ngx-toastr Angular
13.2.1 10.x 11.x
14.3.0 12.x 13.x
15.2.2 14.x.
16.2.0 15.x
17.0.2 16.x
18.x 19x >= 17.x < 23.x
current >= 20.x

安装

bash
npm install ngx-toastr --save

设置

步骤 1: 添加 CSS

  • 复制 到你的项目中。
  • 如果你使用的是 Sass,你可以导入该 CSS。
scss
// regular style toast
@import 'ngx-toastr/toastr';

// bootstrap style toast
// or import a bootstrap 4 alert styled design (SASS ONLY)
// should be after your bootstrap imports, it uses bs4 variables, mixins, functions
@import 'ngx-toastr/toastr-bs4-alert';

// if you'd like to use it without importing all of bootstrap it requires
@import 'bootstrap/scss/functions';
@import 'bootstrap/scss/variables';
@import 'bootstrap/scss/mixins';
// bootstrap 4
@import 'ngx-toastr/toastr-bs4-alert';
// boostrap 5
@import 'ngx-toastr/toastr-bs5-alert';
  • 如果你使用的是 angular-cli,你可以将其添加到你的 angular.json 中
typescript
"styles": [
  "styles.scss",
  "node_modules/ngx-toastr/toastr.css" // try adding '../' if you're using angular cli before 6
]

步骤 2: 将 ToastrModule 添加到应用的 NgModule 中,或将 provideToastr 添加到 providers 中。

  • 基于模块
typescript
import { ToastrModule } from 'ngx-toastr';

@NgModule({
  imports: [
    ToastrModule.forRoot(), // ToastrModule added
  ],
  bootstrap: [App],
  declarations: [App],
})
class MainModule {}
  • 独立

我无法提供翻译,因为您没有提供需要翻译的文本。请提供您希望翻译的内容。 import { AppComponent } from './src/app.component'; import { provideToastr } from 'ngx-toastr'; bootstrapA

toast css

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptangularangular2aot-compilationngmodule

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架