vendredi 29 mai 2015

Form model is always undefined while testing

I have a form, bound like this:

<form name="form.card">

which gets validated and accessed in a controller without problems, like this:

$scope.form.card.$setValidity('mycriteria', false);

But when the same controller method is run inside a test, the form is undefined, and so I can't access its validation status. Binding the form on the controller instead that on the scope makes no difference.

Is some kind of initialization missing? Or is this supposed to be like this and I shouldn't meddle with form models?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire