Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make parent form aware of child form ng-dirty state chan
Message
 
 
À
17/08/2015 12:45:15
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01623431
Message ID:
01623502
Vues:
31
>Didn't have time to look through all that but I see you are not using 'ng-form'
>From angular docs:
>
>"Nestable alias of form directive. HTML does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a sub-group of controls needs to be determined."
>
>If you're not using ng-form your fighting an uphill battle for no reason.
>Did you try my example ?

I don't think in my case it's relevant if I am using form or ng-form for the main form container. I think I tried ng-form with the same result.

The problem here is that my SelectView method seem to happen prior to the directive being hit. In other words, it looks like when I select a new row from the list, first my SelectView method is firing (and the form is obviously in the pristine state already) and then the directive checks for the form.$dirty state which is false at this moment.

In other words, I added this code into my selectView method:
if ($scope.form && $scope.form.$dirty)
                {
                    $scope.selections.somethingChanged = true;
                }
So, when I start from the General tab, change something and go to another tab, I can see that form.$dirty flag is properly set.

But when I select the different row, this code is being executed first before the directive.

So, it seems like my problem is that the directive fires after I already switched to a different row.

I am thinking - may be I can try introducing that check from the directive inside the controller of the index page instead.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform