간단한 2 앱에 대한 알림 메시지를 구현하고 싶습니다. 나는 ng2-toasty
을 사용하기로 결정했다. 내 간단한 각도 2 응용 프로그램은 ng2-admin theme을 기반으로합니다.angular2 앱에 알림 메시지가 표시되지 않습니다.
나는 패키지 를 설치
npm install ng2-toasty --save
가져 오기 및
import { ToastyModule } from 'ng2-toasty'; ... imports: [ ToastyModule.forRoot(), ]
3. 내부 구성 요소가 다시는 토스트 서비스를 가져오고 내부에 주입 된 AppModule에 ToastyModule 등록 생성자
import { ToastyService, ToastyConfig, ToastOptions, ToastData } from 'ng2-toasty';
constructor(private toastyService: ToastyService) { }
...
// This error is raised on purpose inside some method
this.toastyService.error({
title: 'Error',
msg: 'An unexpected error occured!',
theme: 'default',
showClose: true,
timeout: 2000
});
는 app.component.html 내부에서 나는 오류 콘솔 내부에 여전히 알림 메시지가 표시되지 않습니다하지 않는 파일
<ng2-toasty [position="'top-right'"]></ng2-toasty>
의 상단에 추가했다.
systemjs.config.js
또는webpack.config.vendor.js
개의 파일을 업데이트해야하지만이 템플릿 안에 파일을 찾을 수없는 몇 가지 예가 있습니다. 여기서 내가 놓친 게 뭐야?
감사합니다, 나는 공급자에 ToastyService를 추가하지만 같은 일을 경험 해요 : 앱 모듈 업체 [] 배열에 추가합니다. 오류는 없지만 알림 메시지도 없습니다. – user1765862