Cannot Find Control with Path Using ngIf on Recursive Angular Form

前端 未结 1 1855
半阙折子戏
半阙折子戏 2020-12-19 23:07

Here is the stackblitz for the code below. I am making a fairly complex deeply nested Angular form using FormArrays, and child components. For the most part, everything is w

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-19 23:13

    Stackblitz demo

    Let's replace groupInstance for showConjunctor just to make it more obvious about what it's there for.

    You can do this in you app.component.hml:

    
    
    

    I'm considering that i, in the above snippet, is the index of the current loop in *ngFor (like in the Stackblitz demo).

    Also, remove this part from the app.component.html:

    [UPDATE]: Per your comments, if you want to have the conjunctor in all of the nested Groups, you can set the @Input() showConjuntor to true inside the GroupControlComponent (Stackblitz demo):

    
      
      
    
    

    0 讨论(0)
提交回复
热议问题