Why form undefined inside ng-include when checking $pristine or $setDirty()?

前端 未结 3 444
鱼传尺愫
鱼传尺愫 2020-12-01 14:06

The following code throws the error \"TypeError: Cannot read property \'$pristine\' of undefined\" when I click the \"check\" button.

app.controller(\'MainCt         


        
3条回答
  •  隐瞒了意图╮
    2020-12-01 14:38

    I know that this is a old question, but i had a similar problem, and i changed the html and included my ng-controller within the html file.

    So instead of

    
    

    Change it too

    
    

    And then in the myForm.html file, wrap the code in a div, and add the ng-controller attribute, so your myForm.html would become

    myForm

    description:

    Form Pristine: {{output}}

    I can see the description: {{descriptionTest}}

    Now your child controller is within the ng-include scope

提交回复
热议问题