René's URL Explorer Experiment


Title: Directive that extends from DefaultValueAccessor applies to all controls instead of respecting the selector. Host's events not being trigerred · Issue #9146 · angular/angular · GitHub

Open Graph Title: Directive that extends from DefaultValueAccessor applies to all controls instead of respecting the selector. Host's events not being trigerred · Issue #9146 · angular/angular

X Title: Directive that extends from DefaultValueAccessor applies to all controls instead of respecting the selector. Host's events not being trigerred · Issue #9146 · angular/angular

Description: I'm submitting a ... bug report feature request support request => Please do not submit support request here, see note at the top of this template. Current behavior I am implementing masked input for text boxes. With ng1 I used to implem...

Open Graph Description: I'm submitting a ... bug report feature request support request => Please do not submit support request here, see note at the top of this template. Current behavior I am implementing masked input f...

X Description: I'm submitting a ... bug report feature request support request => Please do not submit support request here, see note at the top of this template. Current behavior I am implementing masked ...

Opengraph URL: https://github.com/angular/angular/issues/9146

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Directive that extends from DefaultValueAccessor applies to all controls instead of respecting the selector. Host's events not being trigerred","articleBody":"- **I'm submitting a ...**\n- [X] bug report\n- [ ] feature request\n- [ ] support request => Please do not submit support request here, see note at the top of this template.\n\n**Current behavior**\n\nI am implementing masked input for text boxes. With ng1 I used to implement using ngModelController's `$parsers` and `$formatters`. An example implementation can be found at https://plnkr.co/HQSyZkr4VgezzcSNWnuJ (ng1) . On this example the input displays uppercase text and stores (via ngModel) lowercase text.\n\nI managed to replicate the same behavior using `DefaultValueAccessor` as in in the following snippet (based on code posted on example posted on other issue). This code **works** on beta 17 but **doesn't work** on RC1.  Obviously the beta 17 version differs on the import statements.\n\nThe code samples for beta 17 and RC 1 may be found here:\n\nhttps://plnkr.co/yDvm2x3YiKY6LKhRSzQ3 (Beta 17 - It works)\nhttp://plnkr.co/eAEML8VTnvNo78IFGgSB (RC1 - It doesn't work)\n\nWith RC1 the directive applies to all input controls in the form instead of respecting the selector `input[type=uppercase]`. Futhermore the `input` event is never triggered and nor the method `writeValue`\n\n``` typescript\nimport {Directive, Provider, forwardRef, Renderer, ElementRef} from '@angular/core';\nimport {DefaultValueAccessor, NG_VALUE_ACCESSOR, NG_VALIDATORS, Validator, Control} from '@angular/common';\n\nconst FORMAT_CPF_VALUE_ACCESSOR = new Provider(NG_VALUE_ACCESSOR, {\n    useExisting: forwardRef(() => UpperCaseValueAccessor),\n    multi: true\n});\n\n@Directive({\n    selector: 'input[type=uppercase]',\n    host: {\n        \"maxlength\": \"14\",\n        \"minlength\": \"14\",\n        \"min\": \"0\",\n        \"type\": \"text\",\n        \"(input)\": \"input($event.target.value)\",\n        \"(blur)\": \"blur()\"\n    },\n    bindings: [FORMAT_CPF_VALUE_ACCESSOR]\n})\nexport class UpperCaseValueAccessor  extends DefaultValueAccessor  {\n\n    constructor(renderer: Renderer, elementRef: ElementRef) {\n        elementRef.nativeElement.style.backgroundColor = 'yellow';\n        super(renderer, elementRef);\n    }\n\n    ngAfterViewInit() { }\n\n    blur() {\n        this.onTouched();\n    }\n\n    input(value : string) {\n        // Write back to model\n        if (value) {\n            value = value.toLowerCase();\n            //write formatted to to control view\n            (\u003cany>this)._elementRef.nativeElement.value = value.toUpperCase();\n        }\n        this.onChange(value);\n    }\n\n    writeValue(value: any): void {\n        // Write to view\n        if (value) {\n            value = value.toUpperCase();\n        }\n        super.writeValue(value);\n    }\n}\n```\n\nThe code for component using the directive : \n\n``` typescript\nimport {Component} from '@angular/core';\nimport {ControlGroup, Control, FormBuilder, Validators} from '@angular/common';\nimport {UpperCaseValueAccessor} from './uppercase-directive';\n\ninterface FormData {\n    name : string;\n    uppercaseText: string;\n}\n\n@Component({\n  selector: 'my-app',\n  providers: [],\n  template: `\n        \u003cform [ngFormModel]=\"dataForm\">\n            \u003clabel for=\"inputName\">Name\u003c/label>\n            \u003cinput type=\"text\" [(ngModel)]=\"data.name\" [ngFormControl]=\"dataForm.controls.name\" id=\"inputName\" placeholder=\"Name\">\n            \u003cdiv [hidden]=\"dataForm.controls.name.valid || dataForm.controls.name.pristine\" class=\"alert alert-danger\">Name is required\u003c/div>\n\n            \u003cp>\u003c/p>\n\n            \u003clabel for=\"upperText\">Uppercase text\u003c/label>\n            \u003cinput type=\"uppercase\" [(ngModel)]=\"data.uppercaseText\" [ngFormControl]=\"dataForm.controls.uppercaseText\" id=\"upperText\" placeholder=\"Something\">\n\n            \u003cp>\u003c/p>\n\n             \u003cbutton [disabled]=\"!dataForm.valid\" (click)=\"submitForm()\">Submit\u003c/button>\n             \u003cbutton (click)=\"resetForm()\">Reset\u003c/button>\n\n             \u003cp>\u003c/p>\n\n             \u003cpre>{{data | json}}\u003c/pre>\n        \u003c/form>\n  `,\n  directives : [UpperCaseValueAccessor],\n})\nexport class App {\n    dataForm : ControlGroup; \n    data : FormData = \u003cFormData> {};\n\n    constructor(private fb : FormBuilder) {\n        this.buildForm();\n    }\n\n    buildForm() {\n        this.dataForm = this.fb.group({\n            name : ['', Validators.required],\n            uppercaseText : ['']\n        });\n    }\n\n    submitForm() {\n        console.log(this.dataForm.value);\n    }\n\n    resetForm() {\n        this.buildForm();\n    }\n}\n```\n\n**Expected/desired behavior**\n\nhttps://plnkr.co/yDvm2x3YiKY6LKhRSzQ3 (Beta 17 - It works)\nhttp://plnkr.co/eAEML8VTnvNo78IFGgSB (RC1 - It doesn't work)\n- **What is the expected behavior?**\n\nThe directive would apply only to componenet specified in the selector `input[type=uppercase]`, the event `input` would be triggered and the method `writeValue` would be invoked.\n- **Please tell us about your environment:**\n- **Angular version:** 2.0.0-RC.1 \n- **Browser:** [Chrome 51] \n- **Language:** [all | TypeScript 1.8.10] \n","author":{"url":"https://github.com/daniel-a-melo","@type":"Person","name":"daniel-a-melo"},"datePublished":"2016-06-10T21:44:01Z","url":"https://github.com/angular/angular/issues/9146"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a39df659-09ef-085b-2886-9277ddfef4cc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC264:2AAD2E:A6CD0F:E02612:6B00EFFE
html-safe-noncef65305a2191116c52d09be87a46a47568b2a6dc5e4bfc386c7c8bcf20c6bf36e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjY0OjJBQUQyRTpBNkNEMEY6RTAyNjEyOjZCMDBFRkZFIiwidmlzaXRvcl9pZCI6IjI5Mzk0MzQ0NTYyMTEwNTg2ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacac52fb33303b54121328be536e69166aa4e613fa11b24639fc7dc35001399220
hovercard-subject-tagissue:159729468
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/9146/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8e8b4fcd6485b27d788cb0f5a59287bb3b506c64d7afc84fcc689ddd3c29a8fb/angular/angular/issues/9146
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8e8b4fcd6485b27d788cb0f5a59287bb3b506c64d7afc84fcc689ddd3c29a8fb/angular/angular/issues/9146
og:image:altI'm submitting a ... bug report feature request support request => Please do not submit support request here, see note at the top of this template. Current behavior I am implementing masked input f...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedaniel-a-melo
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/angular/angular git https://github.com/angular/angular.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id24195339
octolytics-dimension-repository_nwoangular/angular
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24195339
octolytics-dimension-repository_network_root_nwoangular/angular
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular/issues/9146#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F9146
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular%2Fissues%2F9146
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular
Reloadhttps://github.com/angular/angular/issues/9146
Reloadhttps://github.com/angular/angular/issues/9146
Reloadhttps://github.com/angular/angular/issues/9146
angularhttps://github.com/angular
angularhttps://github.com/angular/angular
Codehttps://github.com/angular/angular
Issues835 (835)https://github.com/angular/angular/issues
Pull requests140 (140)https://github.com/angular/angular/pulls
Discussionshttps://github.com/angular/angular/discussions
Actionshttps://github.com/angular/angular/actions
Projectshttps://github.com/angular/angular/projects
Security and quality40 (40)https://github.com/angular/angular/security
Insightshttps://github.com/angular/angular/insights
https://github.com/angular/angular
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/9146
New issuehttps://github.com/login?return_to=https://github.com/angular/angular/issues/9146
Directive that extends from DefaultValueAccessor applies to all controls instead of respecting the selector. Host's events not being trigerredhttps://github.com/angular/angular/issues/9146#top
area: formshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20forms%22
https://github.com/daniel-a-melo
daniel-a-melohttps://github.com/daniel-a-melo
on Jun 10, 2016https://github.com/angular/angular/issues/9146#issue-159729468
https://plnkr.co/HQSyZkr4VgezzcSNWnuJhttps://plnkr.co/HQSyZkr4VgezzcSNWnuJ
https://plnkr.co/yDvm2x3YiKY6LKhRSzQ3https://plnkr.co/yDvm2x3YiKY6LKhRSzQ3
http://plnkr.co/eAEML8VTnvNo78IFGgSBhttp://plnkr.co/eAEML8VTnvNo78IFGgSB
https://plnkr.co/yDvm2x3YiKY6LKhRSzQ3https://plnkr.co/yDvm2x3YiKY6LKhRSzQ3
http://plnkr.co/eAEML8VTnvNo78IFGgSBhttp://plnkr.co/eAEML8VTnvNo78IFGgSB
https://github.com/Dinistro
Dinistrohttps://github.com/Dinistro
on Jun 23, 2016https://github.com/angular/angular/issues/9146#issuecomment-227976579
https://github.com/Dinistro
Dinistrohttps://github.com/Dinistro
on Jul 5, 2016https://github.com/angular/angular/issues/9146#issuecomment-230410616
@daniel-a-melohttps://github.com/daniel-a-melo
#9758https://github.com/angular/angular/issues/9758
#8925https://github.com/angular/angular/issues/8925
#8777https://github.com/angular/angular/issues/8777
http://plnkr.co/edit/44imf9KpE06cIyQ395sg?p=previewhttp://plnkr.co/edit/44imf9KpE06cIyQ395sg?p=preview
matskohttps://github.com/matsko
comp: corehttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22comp%3A%20core%22
on Jul 19, 2016https://github.com/angular/angular/issues/9146#event-726900218
https://github.com/Celebes
Celebeshttps://github.com/Celebes
on Jul 19, 2016https://github.com/angular/angular/issues/9146#issuecomment-233656137
https://github.com/zouabimourad
zouabimouradhttps://github.com/zouabimourad
on Jul 27, 2016https://github.com/angular/angular/issues/9146#issuecomment-235578596
https://github.com/stalniy
stalniyhttps://github.com/stalniy
on Jul 28, 2016https://github.com/angular/angular/issues/9146#issuecomment-235930782
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
area: formshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20forms%22
on Aug 20, 2016https://github.com/angular/angular/issues/9146#event-762030022
https://github.com/pkozlowski-opensource
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
on Aug 20, 2016https://github.com/angular/angular/issues/9146#issuecomment-241191899
https://plnkr.co/edit/L9BkYaLUuHiBFClZxOwk?p=previewhttps://plnkr.co/edit/L9BkYaLUuHiBFClZxOwk?p=preview
pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
completedhttps://github.com/angular/angular/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 20, 2016https://github.com/angular/angular/issues/9146#event-762032465
https://github.com/guikubivan
guikubivanhttps://github.com/guikubivan
on Jan 19, 2017https://github.com/angular/angular/issues/9146#issuecomment-273648828
@pkozlowski-opensourcehttps://github.com/pkozlowski-opensource
https://github.com/apps/angular-automatic-lock-bot
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 10, 2019https://github.com/angular/angular/issues/9146#issuecomment-529987766
automatic conversation locking policyhttps://github.com/angular/angular/blob/67d80f/docs/GITHUB_PROCESS.md#conversation-locking
angular-automatic-lock-bothttps://github.com/apps/angular-automatic-lock-bot
on Sep 10, 2019https://github.com/angular/angular/issues/9146#event-2622683847
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular/issues/9146
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular/issues/9146
area: formshttps://github.com/angular/angular/issues?q=state%3Aopen%20label%3A%22area%3A%20forms%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.