clbond / ng2-redux-form

Connect Angular 2 forms to Redux stores
17 stars 7 forks source link

There is some issue with npm package #6

Closed lemind closed 7 years ago

lemind commented 7 years ago

I set up npm package but I see few errors about this package

Imaget

And some issue is with setting of package because of I can't import it.

File '/home/dl/_prog/angular2-redux-example/node_modules/ng2-redux-form/index.d.ts' is not a module.
Exported external package typings file '/home/dl/_prog/angular2-redux-example/node_modules/ng2-redux-form/index.d.ts' is not a module. Please contact the package author to update the package definition.
clbond commented 7 years ago

Hmm! Thank you lemond. I will look today

clbond commented 7 years ago

This was fixed in https://github.com/clbond/ng2-redux-form/commit/c4cd3049d01416e7c1ef884dc1088efe6c7e1145. My apologies!

dancancro commented 7 years ago

Thanks. That fixed it for me. I updated to 1.0.15 and now I have this error in the browser when running the example:

core.umd.js:6001Error: Uncaught (in promise): TypeError: container.registerControl is not a function
    at resolvePromise (http://localhost:8080/main.js:18347:33)
    at http://localhost:8080/main.js:18383:19
    at ZoneDelegate.invokeTask (http://localhost:8080/main.js:18154:39)
    at Object.onInvokeTask (http://localhost:8080/main.js:46540:46)
    at ZoneDelegate.invokeTask (http://localhost:8080/main.js:18153:44)
    at Zone.runTask (http://localhost:8080/main.js:18054:49)
    at drainMicroTaskQueue (http://localhost:8080/main.js:18286:37)

My fork

clbond commented 7 years ago

@dancancro Thank you for this bug report. I believe it is addressed by https://github.com/clbond/ng2-redux-form/commit/228f748828a9f03a7d65d0cc3ad215546f3377df. I added your 'nested array' code to the main example as well. Thank you!

lemind commented 7 years ago

@clbond Hello. I have another one. It was when I try to run angular2-redux-example with ng2-redux-form

Image

clbond commented 7 years ago

Take the exclude: /node_modules/ out from your webpack/loaders.js

lemind commented 7 years ago

@clbond It has solved issue. But I should change it every time. Could be another way how I can fix it permanently?

And anyway I have another error.

clbond commented 7 years ago

Upgrade your rxjs package to 5.0.0-beta.12

dancancro commented 7 years ago

I'm not sure this is related. I updated ng2-redux-form, added it to my project and I am getting this error. I hadn't tested ng2-redux-form yet in my project before so I'm still open to suspects. It could be this issue which was closed for being stale, but I don't know.

zone.js?fad3:484 Unhandled Promise rejection: Template parse errors:
No provider for ControlContainer ("[ERROR ->]<form connect="list">
<div class="heading">
<div class="row">
"): ListPage@0:0 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
No provider for ControlContainer ("[ERROR ->]<form connect="list">
<div class="heading">
<div class="row">
"): ListPage@0:0
    at TemplateParser.parse (eval at <anonymous> (http://localhost:8080/app.js:1045:1), <anonymous>:133:19)
    at RuntimeCompiler._compileTemplate (eval at <anonymous> (http://localhost:8080/app.js:3012:1), <anonymous>:244:51)
    at eval (eval at <anonymous> (http://localhost:8080/app.js:3012:1), <anonymous>:167:83)
    at Set.forEach (native)
    at compile (eval at <anonymous> (http://localhost:8080/app.js:3012:1), <anonymous>:167:47)
    at ZoneDelegate.invoke (eval at <anonymous> (http://localhost:8080/polyfills.js:4397:1), <anonymous>:332:29)
    at Zone.run (eval at <anonymous> (http://localhost:8080/polyfills.js:4397:1), <anonymous>:225:44)
    at eval (eval at <anonymous> (http://localhost:8080/polyfills.js:4397:1), <anonymous>:591:58)
    at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:4397:1), <anonymous>:365:38)
    at Zone.runTask (eval at <anonymous> (http://localhost:8080/polyfills.js:4397:1), <anonymous>:265:48)
clbond commented 7 years ago

Looks like something you might see if FormsModule and ReactiveFormsModule were not imported into your @NgModule.

dancancro commented 7 years ago

That was it. Very well done. Thanks!

clbond commented 7 years ago

No problem! I am happy to see people trying out the library. I would love any feedback you can provide about what works and what doesn't; what's clear and what isn't; etc. Also, thank you for your code contribution Dan (the nested array)!

dancancro commented 7 years ago

Well, since you asked....

I'm having the ControlContainer problem again but in a different place. Before it was complaining about this spot of list.page.html. Now it is complaining about this line of objection.component.html which is used in list.page.html.

Unhandled Promise rejection: Template parse errors:
No provider for ControlContainer ("t()">
          <template connectArray let-rebuttal connectArrayOf="objection.rebuttals">
          [ERROR ->]<li [ngModelGroup]="rebuttal" [ngClass]="{touched: rebuttal.touched}">
            <list-rebuttal 
  "): ObjectionComponent@13:10 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
No provider for ControlContainer ("t()">
          <template connectArray let-rebuttal connectArrayOf="objection.rebuttals">
          [ERROR ->]<li [ngModelGroup]="rebuttal" [ngClass]="{touched: rebuttal.touched}">
            <list-rebuttal 
  "): ObjectionComponent@13:10

I added the missing FormsModule import to list.module.ts which is imported into app.module.ts

The page is structured as

list.page.html  
  <form connect="list$ | async">
    <list-objection>'s //  objection.component.html
       <list-rebuttal>'s // rebuttal.component.html
  </form>
clbond commented 7 years ago

@dancancro There are lots of problems with your code. First off you are not importing ng2-redux-form or adding it to your module imports list anywhere. So the library is not even being included in the application bundle. Secondly you are not using template-driven forms; your components expect to be given actual objects. Your components should ultimately produce a <form> tag that matches the shape of your Redux state - but your code doesn't do this. Unfortunately I don't have the time to debug and fix the code in your repository.

dancancro commented 7 years ago

Hi Chris. I abandoned that project after being stuck for too long. Now I'm onto this ngrx one in which I thought about using your library for my version of the Tour of Heroes contacts page. Thank you for clarifying that it won't work. Welcome back!