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 |
npm install ngx-toastr --save步骤 1: 添加 CSS
// 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';"styles": [
"styles.scss",
"node_modules/ngx-toastr/toastr.css" // try adding '../' if you're using angular cli before 6
]步骤 2: 将 ToastrModule 添加到应用的 NgModule 中,或将 provideToastr 添加到 providers 中。
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
暂无开放 Issues,或尚未同步最近议题。