curiouswebster
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are welcome.
ASKER
can this array:
instead hold PuzzlePieceComponent objects? Or is that not how it works in Angular?
this.piece[i] = Math.ceil(Math.random() * 100);
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.
That piece can be any JavaScript object - and that is exactly how Angular works - objects and streams.
ASKER
So, would I use "new" ? I would be instantiating a new PuzzlePiece object.
Can I pass in an input parameter at this step?
Can I pass in an input parameter at this step?
ASKER
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.
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.
ASKER