Skip to content

connect directive cannot read property controls of undefined as it is checking for this.form and not this.formGroup #102

Open

Description

@tgdeakin

This is a...

  • feature request
  • bug report
  • usage question

What toolchain are you using for transpilation/bundling?

  • @angular/cli
  • Custom @ngTools/webpack
  • Raw ngc
  • SystemJS
  • Rollup
  • Other

Environment

NodeJS Version: 10.16.3
Typescript Version: 3.5.3
Angular Version: 8.2.2
@angular-redux/store version: 10.0.0
@angular/cli version: (if applicable) 8.2.2
OS: Mac OS Mojave

Expected Behaviour:

Form should connect to redux, like so:

<form connect="myForm" [formGroup]="personalDetailsForm" (ngSubmit)="onSubmit(personalDetailsForm.value)">

Actual Behaviour:

I get this error:

Screenshot 2019-09-28 at 20 19 42

When digging into the source I see this:

Screenshot 2019-09-28 at 20 20 03

From what I can see there's a fix for this to use formGroup rather than form, here, but the source that I have doesn't seem to have this fix, so obviously I am getting an error as it's checking for form and not formGroup.

I am using the latest @angular-redux/forms package, v10.

Am I missing something really silly here?

Activity

  1. changed the title [-]formGroup not mapping to connect directive when using reactive form[/-] [+]connect directive cannot read property controls of undefined as it is checking for `this.form` and not `this.formGroup`[/+] on Sep 28, 2019
  2. changed the title [-]connect directive cannot read property controls of undefined as it is checking for `this.form` and not `this.formGroup`[/-] [+]connect directive cannot read property controls of undefined as it is checking for this.form and not this.formGroup[/+] on Sep 28, 2019
  3. dkowis commented on Dec 2, 2019

    @dkowis

    I am also having this exact problem with 10.0.0. Very frustrating. Can't do form integration at this point... I haven't found the silly thing you're missing.

  4. dkowis commented on Dec 2, 2019

    @dkowis

    I get a slightly different error though:
    image

  5. dkowis commented on Dec 2, 2019

    @dkowis

    That referenced commit is the 1st commit after releasing 10.0.0.

    Could we get a 10.0.1 please?

  6. dkowis commented on Dec 4, 2019

    @dkowis

    It seems as though NPM does not support installing a package from git when it's in a monorepo. This is a huge pain in my butt. Does anyone on this thread know how to install that way?

    A quick solution would be a 10.0.1. @smithad15 could you knock this out?

  7. dkowis commented on Dec 4, 2019

    @dkowis

    https://github.com/angular-redux/platform/blob/master/CONTRIBUTING.md#canary-releases

    I just discovered this in the CONTRIBUTING.md, that should be sufficient for now!

    @tgdeakin it works great using the canary build. No problems, and I see my FORM_CHANGED action, and my state updates:
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions