angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

New unaltered project crashes in browser after adding generated component #2356

Open mfsjr opened 7 years ago

mfsjr commented 7 years ago
Item Version
generator-angular-fullstack 4.1.0 (and 4.0.3)
Node 6.9.1 (and 4.4.5)
npm 3.10.8
Operating System OS X 10.11.6
Item Answer
Transpiler Babel
Markup HTML
CSS CSS
Router ui-router
Client Tests Mocha + Chai + Sinon
DB SQL
Auth Y

Bootstrap UI Bootstrap

Created and built this project as indicated. The app comes up and runs out of the box.

Then do this: yo angular-fullstack:component StockModal

Then in app.js alter these lines to include the StockModal component in the app:

import util from '../components/util/util.module';
import StockModal from './components/StockModal/StockModal.component'; //<---

angular.module('componentProblemApp', [ngCookies, ngResource, ngSanitize, uiRouter, uiBootstrap,
  _Auth, account, admin, navbar, footer, main, constants, util, StockModal //<---

Try running again, this time you get an error in Chrome:

Uncaught Error: [$injector:modulerr] Failed to instantiate module componentProblemApp due to:
  (anonymous function)  
  (anonymous function)  
  forEach   
  loadModules   
  createInjector    
  doBootstrap   
  bootstrap 
  (anonymous function)  
  trigger   
  defaultHandlerWrapper 
  eventHandler  

Apologies if I'm missing something simple here...

Thanks, Matt

mfsjr commented 7 years ago

Looks like the problem is, of all things, capitalization. If you enter a component name with the first letter capitalized, this is the result. I checked with the angular style guide and it suggests directives (so one would assume components) should have the first letter in lower case, but this is a bear to figure out.

Would be nice if the generator enforced that, or you got a meaningful error (somewhere other than a release build).

If you could point me to the code I would do a PR.