Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No .html file when creating a module #105

Open
corneadoug opened this issue Mar 11, 2015 · 2 comments
Open

No .html file when creating a module #105

corneadoug opened this issue Mar 11, 2015 · 2 comments

Comments

@corneadoug
Copy link

I find it pretty strange for a 'module' not to have it's own .html file.
You will obviously cut your module into multiple partials, but you still need to define the ui-view or ng-include for your partials. (What better place than the module .html?)

@cgross
Copy link
Owner

cgross commented Mar 14, 2015

I have no idea what sense it would make to have a random html file created when you create a module. If you want a partial, create one in the module...? Why would you declare a ui-view in a module? Wouldn't that go in the main app (likely the index.html)?

@corneadoug
Copy link
Author

Maybe I wasn't concise enough,

When you create your angular app, you will have your app module in app.js, and your index.html file.

From the angular Module Documentation: 'Most applications have a main method that instantiates and wires together the different parts of the application.'

I think that it should not only apply to .js files, just like index.html is linking other partials of the app module, then having a .html file in a module would link its own partials.

For big applications, especially those needing ui-router, you will start breaking your application modules base on your main 'pages'.

For example, if you visit mywebsite.com/admin, you would see your admin page, which is composed of multiple partials which are all connected together in admin.html.

admin.html

<div>
  <div ng-include="admin-partial1/admin-partial1.html"></div>
  <div ng-include="admin-partial2/admin-partial2.html"></div>
  <div ng-include="adming-partial3/admin-partial3.html"></div>
</div>

In the current module configuration, we need to create a first partial to do the job of admin.html (admin-partial), then create all the other partials into admin-partial if we want to respect some kind of logical directory structure. Which in the end is not super elegant.

Maybe it is only a personal choice, juste like the fact that I like having a main controller in a module (and I can simply add it inside app.js or my_module.js).

I can of course just create by hand that .html file, I just thought it could make sense to have it directly in the generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants