本文介绍了ng-snotify,路线更改未显示任何通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

this.snotifyService.success('用户已通过身份验证','登录成功',{超时:2000,showProgressBar:否,closeOnClick:否,pauseOnHover:正确});this.router.navigate(['omanCargo/home']);

this.snotifyService.success('User is authenticated', 'Login Success', {timeout: 2000,showProgressBar: false,closeOnClick: false,pauseOnHover: true});this.router.navigate(['omanCargo/home']);

如图所示,当我触发成功消息后更改路线时,没有任何显示.任何帮助将不胜感激,我是Angle 4的新手.

When i change the route after triggering the success message as shown nothing displays.Any help will be appreciated, i am a newbie in angular 4

推荐答案

您是导入CSS 的地方吗?您应该以全局样式导入其中一个.

did you import the CSS somewhere?You should import one of this in your global style.scss like this

@import "~ng-snotify/styles/material"; 

@import "~ng-snotify/styles/material.css"; 

如果使用CSS语法.

如果使用CSS语法和angular-cli.直接在.angular-cli.json

if you using css syntax and angular-cli. Import styles directly in .angular-cli.json

{
  "styles": [
          "../node_modules/ng-snotify/styles/{STYLE_NAME}.css",
          "styles.css"
  ]
}

确保输入

Also make sure you put

<ng-snotify></ng-snotify>

在您应用程序根目录附近的某个地方,我将我的文件夹放在home.component.ts

somewhere near the root of your application, I put mine in my home.component.ts

这篇关于ng-snotify,路线更改未显示任何通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 12:55