Based on the Angular guide on creating dynamic forms I've set up a bunch of classes that can create forms on the fly. This works great, but it doesn't actually save much effort over just writing the html if I can't just dynamically base the forms on a model object.
So I created a service that dynamically builds the forms based on the properties in a model object.
The problem- the model object is returned from a web service asynchronously. So Angular blows up when doing its initial binding.
I've tried making formConfig a
Promise or an
Observable and changing this call to:
<dynamic-form [formConfig]="formConfig | async"></dynamic-form>
but it is still trying to bind immediately and blowing up because
undefined is being passed into
I believe the problem is that the
async pipe doesn't seem to work as I'd expect on my custom component.