Did anything come from this? This is still the same in v1.2.x any
workarounds?
Op woensdag 5 juni 2013 08:34:18 UTC+2 schreef Kristoffer Ahl:
>
> Still haven't found a fix for this issue so it would be great if anyone
> can share their thoughts on this.
>
> Den onsdagen den 29:e maj 2013 kl. 11:42:35 UTC+2 skrev Kristoffer Ahl:
>>
>> I have a login form where I use ng-if to remove the form from the DOM
>> when the user is authenticated.
>> In the controller that handles the form submission I have a login
>> function that checks the form validity before doing anything else.
>>
>> When I submit the form, I get an exception on the first line of the login
>> function. It seems the loginForm is not available on $scope so I get an
>> property of undefined error.
>> If I change to using *ng-show* instead of *ng-if*, it all works as
>> expected. Is there a way to access the forms properties when using ng-if?
>>
>> Below is the essence of what I have:
>>
>> *HTML:*
>>
>> <div ng-controller="AuthenticationCtrl">
>> <form name="loginForm" ng-submit="login()" ng-if="!user" novalidate>
>> <fieldset>
>> <legend>Log in</legend>
>> <p class="control-group">
>> <label for="authentication.username">Username</label>
>> <input id="authentication.username" type="text"
>> ng-model="doc.username" required="required" />
>> </p>
>> <p class="control-group">
>> <label for="authentication.password">Password</label>
>> <input id="authentication.password" type="password"
>> ng-model="doc.password" required="required" />
>> </p>
>> <p class="form-actions">
>> <input type="submit" value="Log in"
>> ng-disabled="loginForm.$invalid" />
>> </p>
>> </fieldset>
>> </form>
>> </div>
>>
>> *AuthenticationCtrl:*
>>
>> $scope.login = function () {
>> if ($scope.loginForm.$invalid) { return; }
>> // Do login ...
>> };
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.