Ng-class does not run on invalid form field

I am testing the angular-fcsa-number directive, during the process this input field wrapper is not assigned the "has-error" class, although this field is not valid. It seems to me that the ng class is not recognizing that the field is invalid. What am I doing wrong here?

<form id="form1" runat="server" name="form1">
    <div class="form-group" data-ng-class="{ 'has-error': form1.fcsaPlugin.$invalid }">
        <label>FCSA Number</label>
        <input type="text" name="fcsaPlugin" class="form-control" data-ng-model="action.FV10036" fcsa-number />
    </div>
</form>

      

+3


source to share


1 answer


as you say it works when you remove the runat = "server" attribute. You might be using asp.net MasterPages. If you tried to validate the html, basically check the form name in the rendered html. if you are using MasterPage in asp.net the form name will be aspnetForm so your data-ng class should be



data-ng-class="{ 'has-error': aspnetForm.fcsaPlugin.$invalid }"

      

0


source







All Articles