rero / ng-core

Angular library for Invenio
4 stars 12 forks source link

Hide the loading wheels when the editor is renderer. #497

Open jma opened 2 years ago

jma commented 2 years ago

Describe the issue The loading wheels should disappears when the editor is finished to render.

here is a suggestion of implementation from the ngx-formly author:

FormlyModule.forRoot({
  extensions: [
    { name: 'custom-extension', extension: { prePopulate: customExtension } },
  ],
}),

export function customExtension(field: FormlyFieldConfig) {
  field.templateOptions = field.templateOptions || {};
  if (field.parent || field.templateOptions.initialized) {
    return;
  }

  field.templateOptions.initialized = true;
  field.fieldGroup.push({
    hooks: {
      afterViewInit: () => {
        console.warn('FORM LOADED');
      }
    }
  });
}