How can I use NgFor without creating arrays to generate matrix UI pattern

后端 未结 5 1362
无人及你
无人及你 2021-01-12 16:36

I would like to implement UI matrix pattern, which should generate dynamically. By receiving input parameter it should decide what would be UI matrix pattern dimensions: For

5条回答
  •  囚心锁ツ
    2021-01-12 17:14

    After reading all answers I managed to solve it:

     public chooseGamePattern() {
        if (this.cardType === 3) {
            this.horizontalElementLocation = 9;
            this.verticalElementLocation = 3;
            this.rows = new Array(this.verticalElementLocation);
            this.elements = new Array(this.horizontalElementLocation);
        }
    

    It works for me. Thank You all!!!

提交回复
热议问题