accessing child components data in other component's array in angular


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;


  constructor() {
    this.pages = Array( //rather than Array(5) 
      .map((x, i) => i);

  get currentPage() {

Here’s the stackblitz


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?

Answered By – Vasileios Kagklis

Answer Checked By – Gilberto Lyons (AngularFixing Admin)

Leave a Reply

Your email address will not be published.