Я хочу показать те же результаты моего поиска после обновления моей страницы. Например, я ищу одного флаера, задавая параметры года, недели, страницы, филиала (2017, 17, 01, R) через мой запрос на получение. Когда я обновляю sh мою страницу, я захожу к параметрам, которые находятся в ngOnInIt.
Я хочу показать последние результаты в соответствии с моими параметрами поиска, а не то, что есть в ngOnInIt (). Ниже мой компонент.
ngOnInit() {
if (this.showRaster === true) {
this.jahr = this.year;
this.woche = this.week;
this.seite = this.page;
this.filiale = this.branch;
this.flyerhammService.getFlyer(this.branch, this.year, this.woche, this.seite)
.then(
flyers => {
this.flyers = flyers;
this.raster = this.flyers[0].Raster;
}
).catch(
error => console.log(error)
);
} else {
// Below code is to get a flyer with current values of week and year and seite will always be 01
this.jahr = (new Date()).getFullYear();
this.currentWeek = String((this.currentWeekNumber()));
if (this.currentWeek.length < 2) {
this.woche = '0' + this.currentWeek;
} else {
this.woche = this.currentWeek;
}
this.seite = '01';
this.filiale = 'H';
this.flyerhammService.getFlyer(this.filiale, this.jahr, this.woche, this.seite)
.then(
flyers => {
this.flyers = flyers;
this.raster = this.flyers[0].Raster;
}
).catch(
error => console.log(error)
);
}
}
Я пытаюсь сделать это с afterViewInit, но не могу получить то, что я хочу. Может кто-нибудь сказать мне, что я делаю неправильно, и как я могу показать те же результаты даже после того, как я обновил sh страницу?