AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

CLI-generated form fails with TypeError #97

Closed e2jk closed 9 years ago

e2jk commented 9 years ago

I've used the CLI to create a form from a new model. When going to the page to add a new record, the following exception is logged in the console: TypeError: this.model is null

I have noticed that the form created with the demo app are set up like this:

value: this.model && this.model.firstName,

whereas the CLI-generated forms have the following:

value: this.model.name || "",

Changing the value to the first form solves this issue. Is there any reason against updating the CLI to generate code in that way?

bear commented 9 years ago

That sounds like a great Pull Request to make - go for it

e2jk commented 9 years ago

I had some trouble finding the exact spot, but https://github.com/AmpersandJS/ampersand/pull/99 is now ready for your review.