如何显示在角2
回答
我已经使用了PrimeNG包,其中包括大量的UI组件, 有消息组件来显示通知: PrimeNG - Messages Component
希望它能帮助, 利奥尔
如果我们正在创造的一些成套FE我们正在使用已实施小吃店的Angular2材料。
https://github.com/angular/material2
https://material.angular.io/components
或者,您可以轻松地将烤面包机,将显示漂亮的材料祝酒 https://github.com/PointInside/ng2-toastr
我强烈建议都无一不在生产中进行了测试(虽然素材库目前仍beta)
多士炉简单易用:) – refactor
另一种选择是ng2-toasty
下面是步骤:
1)安装使用 - npm install ng2-toasty --save
2)更新systemjs.config.js
System.config({
map: {
'ng2-toasty': 'node_modules/ng2-toasty/bundles/index.umd.js'
}
});
3)导入ToastyModule
import {BrowserModule} from "@angular/platform-browser";
import {NgModule} from '@angular/core';
import {ToastyModule} from 'ng2-toasty';
@NgModule({
imports: [
BrowserModule,
ToastyModule.forRoot()
],
bootstrap: [AppComponent]
})
export class AppModule {
}
4)使用ToastyService作为您的应用程序
import {Component} from '@angular/core';
import {ToastyService, ToastyConfig, ToastOptions, ToastData} from 'ng2-toasty';
@Component({
selector: 'app',
template: `
<div>Hello world</div>
<button (click)="addToast()">Add Toast</button>
<ng2-toasty></ng2-toasty>
`
})
export class AppComponent {
constructor(private toastyService:ToastyService, private toastyConfig: ToastyConfig) {
// Assign the selected theme name to the `theme` property of the instance of ToastyConfig.
// Possible values: default, bootstrap, material
this.toastyConfig.theme = 'material';
}
addToast() {
// Just add default Toast with title only
this.toastyService.default('Hi there');
// Or create the instance of ToastOptions
var toastOptions:ToastOptions = {
title: "My title",
msg: "The message",
showClose: true,
timeout: 5000,
theme: 'default',
onAdd: (toast:ToastData) => {
console.log('Toast ' + toast.id + ' has been added!');
},
onRemove: function(toast:ToastData) {
console.log('Toast ' + toast.id + ' has been removed!');
}
};
// Add see all possible types in one shot
this.toastyService.info(toastOptions);
this.toastyService.success(toastOptions);
this.toastyService.wait(toastOptions);
this.toastyService.error(toastOptions);
this.toastyService.warning(toastOptions);
}
}
简单的演示可在这里 - http://akserg.github.io/ng2-webpack-demo/#/toasty
这里提供的示例代码 - https://github.com/akserg/ng2-systemjs-demo
ng2-notify-popup对角2是基于ng-notify。你可以尝试使用它。
我推荐的'angular2-notifications'使用起来非常简单灵活。
的更多细节和演示:https://jaspero.co/resources/projects/ng-alerts
而且我们可以做alers与NG2的警告推动他们
检查这个NPM包,它的超级好用,可能是你需要的东西!
- 1. 如何显示在角2
- 2. 如何显示在角2
- 3. 如何显示在角2
- 4. 如何隐藏/显示在角2
- 5. 角2不显示
- 6. 如何以角度2显示组件?
- 7. 角2 - 如何向显示对象
- 8. 如何显示在角4
- 9. 如何显示在角JS
- 10. 角2组件不显示
- 11. 显示图表 - 角2
- 12. 额外li显示在角2 ngFor
- 13. 如何在角度2中显示验证消息?
- 14. 如何在角度2中显示观察值?
- 15. 如何在角2
- 16. 如何在角2
- 17. 如何在角2
- 18. 如何在角2
- 19. 如何显示与角
- 20. 如何显示symfony角色
- 21. 如何在ASP.NET中显示角色?
- 22. 如何使用角1指示在角2
- 23. 显示JSON对象模板角2
- 24. 角:显示2场(采用NG-消息)
- 25. 显示模式弹出的角2
- 26. 显示字体真棒 - 角2
- 27. 显示的图标动态地角2
- 28. 角度2旋转木马不显示
- 29. 角度选择设置显示2
- 30. 数据确实显示了角2 primeng
试试这个:https://github.com/flauc/angular2-notifications或者你可以创建自己的。 –
您可以使用ng2-notify或者您可以编写自己的通知(https://www.npmjs.com/package/ng2-notify)。 –
我可以推荐“ng2-toastr”(npmjs.com/package/ng2-toastr)提供警报,信息等等的通知。非常有用和灵活 – Karl