Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Creating a matrix of components inside another component

I have a PuzzleCanvas object and I need it to contain a matrix of PuzzlePieces 8 columns by 5 rows.

I want this done inside the Component itself so that in the HTML for the PuzzleCanvas I can simply use forEach and iterate through a previously created matrix of components.

How do I do this?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of curiouswebster

ASKER

thanks
You are welcome.
can this array:

this.piece[i] = Math.ceil(Math.random() * 100);

Open in new window


instead hold PuzzlePieceComponent objects? Or is that not how it works in Angular?
Of course - I just did that for the demo - not knowing what you want for there.

That piece can be any JavaScript object - and that is exactly how Angular works - objects and streams.
So, would I use "new" ? I would be instantiating a new PuzzlePiece object.

Can I pass in an input parameter at this step?
I execute your commands and from the correct folder, but can not successfully auto-generate a Component.

The version of Node.js on my machine MAY have been installed with HomeBrew. So, I am not sure that my installation of Node is intact.

I will address a re-install of my environment separately.