Breaking a form between multiple tabs in angular breaks validation

前端 未结 2 1209
别跟我提以往
别跟我提以往 2021-02-06 03:35

I have an angular form spitted between several tabs with angular UI directive.

2条回答
  •  野性不改
    2021-02-06 04:04

    From the ngForm directive docs:

    In Angular, forms can be nested. This means that the outer form is valid when all of the child forms are valid as well. However, browsers do not allow nesting of elements, so Angular provides the ngForm directive, which behaves identically to form but can be nested.

    This means that you can break your campaignForm form into sub-forms for each tab:

    
      
        
          
    Required
    Required

    PLUNKER

    This will circumvent the case where tabs directive (or any other directive that uses isolate scope) is breaking your ngFormController's scope.

提交回复
热议问题