I’m running the plugin in a shell in devicemanagement application.
I haven’t tried to deploy it yet, so maybe the issue only occurs in the shell, I need to test if the bug persists when the plugin is deployed.
Here are some (simplified) snippets if that can help.
Here’s the formly component:
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { CoreModule } from '@c8y/ngx-components';
import { FieldType } from '@ngx-formly/core';
import { PopoverModule } from 'ngx-bootstrap/popover';
@Component({
selector: 'formly-multi-schema-type',
templateUrl: './multischema.type.html',
standalone: true,
imports: [CommonModule, PopoverModule, CoreModule],
})
export class MultiSchemaTypeComponent extends FieldType {}
The HTML template:
<fieldset class="c8y-fieldset schema-form-fieldset">
<legend><span *ngIf="to.label; else display_model_key">{{ to.label }}</span>
<ng-template #display_model_key>{{field.key }}</ng-template>
<button *ngIf="to.description" class="btn-help btn-help--sm m-t-auto m-b-auto" [popover]="to.description"
placement="right" [outsideClick]="true" type="button">
<i c8yIcon="question-circle-o" class="text-primary"></i>
</button>
</legend>
<div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
<formly-validation-message [field]="field"></formly-validation-message>
</div>
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
</fieldset>
The component module that uses formly:
import { NgModule } from '@angular/core';
import { hookRoute, ViewContext } from '@c8y/ngx-components';
import {
ConfigOption,
FORMLY_CONFIG,
FormlyFieldConfig,
} from '@ngx-formly/core';
import { ArrayTypeComponent } from '../formly/array.type';
import { MultiSchemaTypeComponent } from '../formly/multischema.type';
import { NullTypeComponent } from '../formly/null.type';
import { ObjectTypeComponent } from '../formly/object.type';
import { TalqGuard } from './talq.guard';
let config: ConfigOption = {
types: [
{ name: 'multischema', component: MultiSchemaTypeComponent },
],
};
@NgModule({
imports: [
MultiSchemaTypeComponent,
],
providers: [
hookRoute([
{
context: ViewContext.Device,
path: 'talq-view',
loadComponent: () =>
import('./devices.component').then((m) => m.DevicesComponent),
label: 'TALQ',
priority: 0,
icon: 'c8y-energy',
canActivate: [TalqGuard],
},
]),
{
provide: FORMLY_CONFIG,
multi: true,
useValue: config,
},
],
})
export class TalqDevicesModule {}
With this simple example the browser complains that:
Error: [Formly Error] The type "multischema" could not be found. Please make sure that is registered through the FormlyModule declaration.