angular
angular copied to clipboard
[BUG] The CustomTagsService is not exported.
Environment
- Hosting type
- [x] Local deployment
- Version:
- Formio.js version: ^4.13.8.
- Frontend framework: Angular ~12.2.16.
- Browsers: Edge, Chrome, and Firefox.
- Browser versions: The last versions.
Steps to Reproduce
- Create a new component based on the
FormBuilderComponent
.
import { FormioAppConfig, FormioComponent } from '@formio/angular';
@Component({
selector: 'app-form-builder',
templateUrl: './form-builder.component.html',
styleUrls: ['./form-builder.component.scss']
})
export class FormBuilderComponent extends FormioComponent {
constructor(
public ngZone: NgZone,
@Optional() public config: FormioAppConfig,
@Optional() public customTags?: CustomTagsService,
) {
super(ngZone, config, customTags);
}
- Try to import
CustomTagsService
reference in the import section. It can be added to the component. - In angular 12, and angular-formio 5.2.2, the compiler throws errors that the
CustomTagsService
can't be resolved. - If you create a fake service like
CustomTagsService
and inject it, custom components are not shown anymore!
Expected behavior
I expect that the custom components will be displayed on my pages, but they won't.
Observed behavior
The custom components work correctly on the form builder page (form-builder
tag), but they don't work correctly for form viewer (formio
tag).
Suggested solution:
I cloned the source code and added custom-tags.service.ts
reference to the index.ts
file, then I published a new NPM package and used this package for my own project and everything worked correctly.
export * from './core';
export * from './elements.common';
export * from './custom-component/custom-tags.service'; // Add this line.
export * from './custom-component/create-custom-component';
export * from './custom-component/register-custom-component';
export { default as FormioSubmission } from './types/formio-submission';
Relative path in the angular-formio project:
angular\projects\angular-formio\src\index.ts
Import section in my own project:
import { CustomTagsService, FormioAppConfig, FormioComponent } from 'my-own-formbuilder';
If you please provide a pull request with your suggested fix, I will be sure to include it in the next build. Thanks.
If you please provide a pull request with your suggested fix, I will be sure to include it in the next build. Thanks.
I created a pull request for this issue:
#879
FYI: @travist
@travist when will the next npm version will be released ? waiting for some of the bug fixes and features.
We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.
If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.