constructor(private chapterService: ChapterService, private userSevice:ApiService, private route: ActivatedRoute, private ngZone: NgZone) {
this.route.paramMap.subscribe(params => {
this.ngOnInit();
});
this.chapterNumber = "0";
this.username=localStorage.getItem("loggedUserUsername")
//get chapter number save from user
}
getChapter(): any {
const chN = this.route.snapshot.paramMap.get("chNumber");
if (chN) {
this.notificationVisible=false;
return this.chapterService
.GetChapterByChapterNumber(chN)
.pipe(
map(
(data) => {
this.chapter = data;
}))
}
}
ngOnInit(): void {
this.getChapter().subscribe(() => {
console.log('ngOnit after getChapter() ' + this.chapter);
});