I'm trying to set the 5 in Array(5) to another variable in this code:
What I'm trying to do:
export class HelloComponent {
@Input() page: number;
active = 0;
pages;
constructor() {
this.pages = Array(this.page) //rather than Array(5)
.fill(0)
.map((x, i) => i);
this.pages.pop();
}
get currentPage() {
return this.active;
}
}
Here's the stackblitz
CodePudding user response:
Honestly, I'm not sure of what you're trying to do here, but have a look at this fork of your StackBlitz demo.
Is this what you want to do?