0
votes

Quoting the angular documentation :

FormController keeps track of all its controls and nested forms as well as the > > state of them, such as being valid/invalid or dirty/pristine.

Each form directive creates an instance of FormController.

When exactly is this FormController been generated ?

I have a form inside a directive, it seems that this form is generated after the link() function. This is a problem for me.

1
What is the problem you are running into specifically? - Explosion Pills
I've answered below when the controller is available. But you may be asking an XY question - that is, your issue may not be related to "when" FormController is generated... - New Dev

1 Answers

0
votes

form directive has a controller - called colloquially FormController - which other directives could require - e.g. ngModel optionally requires form:

require: "?^form"

form directive can take the following forms:

<form>

or

<ANY ng-form>

Any time form directive (in any of its forms) is compiled and then linked, its FormController instance is available to those that require it.

The controller function of any directive (which constructs the controller instance) runs at link-phase, just before prelink.