thardy / generator-ngbp

Yeoman generator based on the ngBoilerplate kickstarter, a best-practice boilerplate for any scale Angular project built on a highly modular, folder-by-feature structure.
100 stars 23 forks source link

Implemented sub modules handling + fix for modules with a dash #16

Closed FDIM closed 9 years ago

FDIM commented 9 years ago

PR to solve: https://github.com/thardy/generator-ngbp/issues/15

When creating a module and specifying namespace (aka. admin.users.view), would create a 'view' module in admin/users folder.

thardy commented 9 years ago

Hopefully, I can look at this very soon. Thanks for putting this together.

thardy commented 9 years ago

I made one fix to your pull request. Freshly generated submodules had invalid route names and routing wasn't working. They were taking the name of the module (e.g. "account.profile") and anything with a dot in it means inheritance to ui-router. That will only work if you specifiy a ui-view in the parent, yada, yada. It can get pretty complicated. Since I assumed you'd probably just want it to be a unique route right after generation, I replaced any dots with hyphens, so the route name becomes "account-profile" and navigating to /account/profile will work now. That's the simplest happy path, and if someone wants to do fancy routing with nested views, etc, they can change that manually.

For a simple example of nested routing using ui-router, you can view http://jsfiddle.net/thardy/eD3MU/. You might be an expert at ui-router already, but I had to distill it down before I understood it due to the documentation being less than stellar on the topic.