Skip to content

Strongly Typed code example is incorrect #6

Description

@ajayojha

Description

The example code is incorrect, which misleads the developer to right use of strongly typed.
Here is code :

  this.userFormGroup  = this.formBuilder.formGroup(User) as IFormGroup<User>;
        this.userFormGroup.controls.fullName.setValue("John");
        let fullName = this.userFormGroup.value.fullName;

It must be like as below:

  this.userFormGroup  = this.formBuilder.formGroup(User) as IFormGroup<User>;
   let user:User = this.userFormGroup.modelInstance;

Location

Here is the link: https://docs.rxweb.io/how-to/stronglyType/decorators

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions