Title: @Input properties are not being recognized from angular-cli built component library when extending component and using Barrrels · Issue #25249 · angular/angular · GitHub
Open Graph Title: @Input properties are not being recognized from angular-cli built component library when extending component and using Barrrels · Issue #25249 · angular/angular
X Title: @Input properties are not being recognized from angular-cli built component library when extending component and using Barrrels · Issue #25249 · angular/angular
Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ X ] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request [ ] Support request => Please do not sub...
Open Graph Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ X ] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request ...
X Description: I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ X ] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or requ...
Opengraph URL: https://github.com/angular/angular/issues/25249
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@Input properties are not being recognized from angular-cli built component library when extending component and using Barrrels","articleBody":"## I'm submitting a...\r\n\u003cpre>\u003ccode>\r\n[ ] Regression (a behavior that used to work and stopped working in a new release)\r\n[ X ] Bug report \u003c!-- Please search GitHub for a similar issue or PR before submitting -->\r\n[ ] Performance issue\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n[ ] Other... Please describe:\r\n\u003c/code>\u003c/pre>\r\n\r\n## Current behavior\r\nSo I have my base component...\r\n\r\n\u003cpre>\u003ccode>\r\nimport { FormGroup, FormControl, ValidatorFn, Validators, AbstractControl } from '@angular/forms';\r\nimport { SnagFormGroup } from '../forms';\r\nimport { Component, OnInit, Input } from '@angular/core';\r\nimport { IMaskConfig } from '../interfaces';\r\n\r\n@Component({\r\n selector: 'snag-input',\r\n templateUrl: './snag-input.component.html'\r\n})\r\nexport class SnagInputComponent implements OnInit {\r\n\r\n @Input() maskArray: (string | RegExp)[];\r\n @Input() maxLength: number;\r\n @Input() minLength: number;\r\n @Input() regex: RegExp;\r\n @Input() required: boolean;\r\n @Input() label: string = '\u003cNo Label Provided>';\r\n @Input() controlName: string;\r\n @Input() form: SnagFormGroup;\r\n control: FormControl;\r\n validators: ValidatorFn[] = [];\r\n @Input() maskConfig: IMaskConfig = {\r\n mask: null,\r\n pipe: null,\r\n guide: false\r\n };\r\n\r\n ngOnInit(): void {\r\n this.validateInputs();\r\n this.configureInputMask();\r\n this.buildValidators();\r\n this.control = new FormControl('', this.validators);\r\n this.form.addControl(this.controlName, this.control);\r\n }\r\n\r\n constructor() {}\r\n\r\n hasError(errorName: string): boolean {\r\n return (this.control.touched || this.form.submitted) && this.control.hasError(errorName);\r\n }\r\n\r\n isValid(): boolean {\r\n return this.control.touched && this.control.valid;\r\n }\r\n\r\n configureInputMask(): void {\r\n this.maskArray ? this.maskConfig.mask = this.maskArray : null;\r\n }\r\n\r\n trimToMaxLength(conformedValue: string): string {\r\n return conformedValue.substring(0, this.maxLength);\r\n }\r\n\r\n buildValidators(): void {\r\n this.required ? this.validators.push(Validators.required) : null;\r\n this.maxLength ? this.validators.push(Validators.maxLength(this.maxLength)) : null;\r\n this.minLength ? this.validators.push(Validators.minLength(this.minLength)) : null;\r\n this.regex ? this.validators.push(Validators.pattern(this.regex)) : null;\r\n }\r\n\r\n validateInputs() {\r\n if (!this.form) {\r\n throw 'Dont forget to pass in your SnagFormGroup! EX: \u003csnag-input [form]=\\'mySnagFormGroup\\'>';\r\n }\r\n }\r\n\r\n getFormControl(): AbstractControl {\r\n return this.form.controls[this.controlName];\r\n }\r\n\r\n}\r\n\u003c/code>\u003c/pre>\r\n\r\nAnd I have my child components \r\n\u003cpre>\u003ccode>\r\nimport { Component } from '@angular/core';\r\nimport { Validators } from '@angular/forms';\r\nimport { SnagInputComponent } from '../snag-input';\r\n\r\n@Component({\r\n selector: 'snag-email',\r\n templateUrl: 'email.component.html'\r\n})\r\n\r\nexport class EmailComponent extends SnagInputComponent {\r\n\r\n buildValidators(): void {\r\n this.validators.push(Validators.email);\r\n this.required ? this.validators.push(Validators.required) : null;\r\n this.maxLength ? this.validators.push(Validators.maxLength(this.maxLength)) : null;\r\n this.minLength ? this.validators.push(Validators.minLength(this.minLength)) : null;\r\n }\r\n\r\n}\r\n\r\n-------------------------------------------------------------------------------------------\r\n\r\nimport { Component, Input } from '@angular/core';\r\nimport { Validators } from '@angular/forms';\r\nimport { SnagInputComponent } from '../snag-input';\r\n\r\n@Component({\r\n selector: 'snag-select',\r\n templateUrl: 'select.component.html'\r\n})\r\n\r\nexport class SelectComponent extends SnagInputComponent {\r\n\r\n @Input() options: any[];\r\n @Input() value: string;\r\n @Input() name: string;\r\n\r\n}\r\n\r\n\u003c/code>\u003c/pre>\r\n\r\nThe child component is just overriding the buildValidators method. Both of these components exist in a component library generated by angular-cli (v6.0.0). In my app that I use to test the library, if I import the module by pathing to /projects, everything is ok. However, when I build the project library and import the module from the /dist folder, the app can no longer recognize the @input properties that are on the child component from the extended base component. I get the following when I try to build the app with aot, and these errors show up in my IDE also. As you can see every input that comes from the base model is not being recognized.\r\n\r\n\r\n\r\n\r\n\u003cpre>\u003ccode>\r\nERROR in : Can't bind to 'form' since it isn't a known property of 'snag-email'.\r\n1. If 'snag-email' is an Angular component and it has 'form' input, then verify that it is part of this module.\r\n2. If 'snag-email' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.\r\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (\" \u003cdiv *ngIf=\"this.formState != 'fade'\">\r\n \u003cdiv class=\"input-row\">\r\n \u003csnag-email class=\"input\" [ERROR ->][form]=\"form\" [label]=\"'Email'\" [required]=\"true\" [controlName]=\"'email'\">\u003c/snag-email>\r\n \u003csnag-p\")\r\n: Can't bind to 'label' since it isn't a known property of 'snag-email'.\r\n1. If 'snag-email' is an Angular component and it has 'label' input, then verify that it is part of this module.\r\n2. If 'snag-email' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.\r\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (\"his.formState != 'fade'\">\r\n \u003cdiv class=\"input-row\">\r\n \u003csnag-email class=\"input\" [form]=\"form\" [ERROR ->][label]=\"'Email'\" [required]=\"true\" [controlName]=\"'email'\">\u003c/snag-email>\r\n \u003csnag-phone [form]=\"f\")\r\n: Can't bind to 'required' since it isn't a known property of 'snag-email'.\r\n1. If 'snag-email' is an Angular component and it has 'required' input, then verify that it is part of this module.\r\n2. If 'snag-email' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.\r\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (\"fade'\">\r\n \u003cdiv class=\"input-row\">\r\n \u003csnag-email class=\"input\" [form]=\"form\" [label]=\"'Email'\" [ERROR ->][required]=\"true\" [controlName]=\"'email'\">\u003c/snag-email>\r\n \u003csnag-phone [form]=\"form\" [label]=\"'Pho\")\r\n: Can't bind to 'controlName' since it isn't a known property of 'snag-email'.\r\n1. If 'snag-email' is an Angular component and it has 'controlName' input, then verify that it is part of this module.\r\n2. If 'snag-email' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.\r\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (\"lass=\"input-row\">\r\n \u003csnag-email class=\"input\" [form]=\"form\" [label]=\"'Email'\" [required]=\"true\" [ERROR ->][controlName]=\"'email'\">\u003c/snag-email>\r\n \u003csnag-phone [form]=\"form\" [label]=\"'Phone Number'\" [contr\")\r\n\u003c/code>\u003c/pre>\r\n\r\n\r\n\r\n## Environment\r\n\r\n\u003cpre>\u003ccode>\r\nAngular version: 6.0.0\r\n\u003c/code>\u003c/pre>\r\n","author":{"url":"https://github.com/sir-captainmorgan21","@type":"Person","name":"sir-captainmorgan21"},"datePublished":"2018-08-01T16:11:40Z","url":"https://github.com/angular/angular/issues/25249"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f01f7125-9a23-3585-daf8-bc8f7f51c47e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9E5A:2E7EBB:6AFD62:88E519:6B00DFF9 |
| html-safe-nonce | 905f9a3bd2bc2274ba2ddb767ce7a006ba885b9a546531f01109750d62910257 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTVBOjJFN0VCQjo2QUZENjI6ODhFNTE5OjZCMDBERkY5IiwidmlzaXRvcl9pZCI6IjgxMDgyOTI4Mjk0NjMyNDA2OTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c06b26324000af840c1f14eb6b7422c0ded171ee918293f7f91cda3d10def540 |
| hovercard-subject-tag | issue:346668184 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/25249/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ff885a6e434d0b153c13a37eec2d2bbf20da4d78f1a76266ee8112ffc6dea669/angular/angular/issues/25249 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ff885a6e434d0b153c13a37eec2d2bbf20da4d78f1a76266ee8112ffc6dea669/angular/angular/issues/25249 |
| og:image:alt | I'm submitting a... [ ] Regression (a behavior that used to work and stopped working in a new release) [ X ] Bug report [ ] Performance issue [ ] Feature request [ ] Documentation issue or request ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sir-captainmorgan21 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width