I'm trying to get a number from splitting a URL so I could use it in my function, for some reason I keep getting "this.activeId" is undefined. Why is that? I tried looking at other resources and I still dont understand why.
activeId = 0;
ngOnInit() {
this.route.params.subscribe(response => {
let path = window.location.pathname.split(";")[0].split("/").pop();
this.activeId = parseInt(path);
console.Log(this.activeId);
}
}
next() {
const next = this.activeId + 1 >= 9 ? 1 : this.activeId + 1;
this.router.navigateByUrl('/image/' + `${next};id=${this.domain.id};category=${this.domain.category};`);
}