Skip to content

Angular doesn't recognize ControlNames with a 'Dot' "." in the name on ReactiveForms #50608

@JohanJimenex

Description

@JohanJimenex

Which @angular/* package(s) are the source of the bug?

forms

Is this a regression?

No

Description

When I use names with Dot (.) in ControlName angular can't get the control with the method .get("control name");

Example:

...

public myForm = new FormGroup({
  "No. Customer": new FormControl('', Validators.required),
  "Other name": new FormControl('', Validators.required)
});

...

let myControl = myForm.get("No. Customer") // null
let myControl2 = myForm.get("Other name") // Object properties

//however it does come out when I get the controls
console.log(this.myForm.controls) // both controls properties printed

UPDATE:
@JoostK
I tried with console.log(this.myForm.controls["Solicitud No."]); its work!

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 14.1.0
Node: 14.17.6
Package Manager: npm 6.14.15
OS: win32 x64

Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1401.0 (cli-only)
@angular-devkit/core         14.1.0 (cli-only)
@angular-devkit/schematics   14.1.0 (cli-only)
@schematics/angular          14.1.0 (cli-only)

node --version
v14.17.6

npm -version
6.14.15

 "dependencies": {
    "@angular/animations": "^14.1.0",
    "@angular/common": "^14.1.0",
    "@angular/compiler": "^14.1.0",
    "@angular/core": "^14.1.0",
    "@angular/fire": "^7.5.0",
    "@angular/forms": "^14.1.0",
    "@angular/platform-browser": "^14.1.0",
    "@angular/platform-browser-dynamic": "^14.1.0",
    "@angular/router": "^14.1.0",
    "@azure/msal-angular": "^2.4.3",
    "@azure/msal-browser": "^2.28.3",
    "animate.css": "^4.1.1",
    "bootstrap": "^5.2.1",
    "guid-typescript": "^1.0.9",
    "ng2-pdf-viewer": "^9.1.4",
    "primeicons": "^6.0.1",
    "primeng": "^14.2.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.1.0",
    "@angular/cli": "~14.1.0",
    "@angular/compiler-cli": "^14.1.0",
    "@commitlint/cli": "16.3.0",
    "@commitlint/config-conventional": "16.2.4",
    "@types/jasmine": "~4.0.0",
    "husky": "^7.0.4",
    "jasmine-core": "~4.2.0",
    "jasmine-spec-reporter": "^7.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "karma-junit-reporter": "^2.0.1",
    "karma-sonarqube-unit-reporter": "0.0.23",
    "prettier": "^2.8.7",
    "typescript": "~4.7.2"
  }

Windows 10

Chrome browser Versión 114.0.5735.91 (Build oficial) (64 bits)

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions