I'm surprise for this recommendations. There are not only against the Angular Style Guide, but it require extra work from your team if you are using Angular CLI, or any UI that uses the CLI underneath. I would like to give my feedback about this, I hope you don't mind.
I find the router module to be very useful, you could even use it for the components that you are routing, as they are not supposed to be used else where.
Guards are just another kind of services, and thus they should be placed in the CoreModule, if you are using them as app wide services. I do like the idea of placing feature specific guards aside that feature module. However, if you place them all in CoreModule, you can use them in any part of the application, even in features modules.
In the same order of ideas, barrer files are discourage by the Angular Team, but for a good reason: They are not good for tree shaking. Also, they could produce circular dependency errors, but this is really unlikely.
Finally, and I guess this would be the most banal feedback, I wouldn't name a folder with a leading underscore, but I understand that with this you can find those folders better.
Director of Architecture, Chief Architect at Briebug. Google GDE for Angular/Web Tech. I’m a huge weather nerd. I’m here if you need help in Angular, ASP.Net Core, or best practices.
Location
USA
Education
School of Hard Knocks
Work
Director of Architecture, Chief Architect at Briebug
Thanks for the feedback Michael. I appreciate your opinion! It is always great to get feedback on articles that I write.
The concepts laid out in my article are recommendations and preferences. I realize others may not wish to implement ideas in the same manner, and that's OK.
I use the Angular CLI exclusively and these best practices work great with the CLI.
That being said, I would like to counter your claims with the following:
On Folders with leading underscore: This is just a recommendation, and it works fantastic for my team. I have not run across any negative consequences from this. It's quite common out in the wild with several high starred github repos using this.
On Guards - I agree they are a type of service, but they have very unique use-cases, and can only be used directly with route definition. This is why I store them close to the source of use.
Director of Architecture, Chief Architect at Briebug. Google GDE for Angular/Web Tech. I’m a huge weather nerd. I’m here if you need help in Angular, ASP.Net Core, or best practices.
Location
USA
Education
School of Hard Knocks
Work
Director of Architecture, Chief Architect at Briebug
I have admiration for both, but I also have found that this patterns doesn't fit with Angular very well. They are more like React, or Vue. You can use them, but they don't fit. I don't know if I explain myself. However, it's like you said, sometimes, sometimes not.
Director of Architecture, Chief Architect at Briebug. Google GDE for Angular/Web Tech. I’m a huge weather nerd. I’m here if you need help in Angular, ASP.Net Core, or best practices.
Location
USA
Education
School of Hard Knocks
Work
Director of Architecture, Chief Architect at Briebug
Well thanks again for your feedback! Would love to see how you’re building Angular apps for comparison sake. Maybe I’m missing something. If you haven’t already, how about writing an article?
Sure do. I have already write a couple, but nothing specific to organization structure, as I have found the Angular Style Guide a really good approach to manage. I have work in a couple of projects with Angular, and in all of them we always followed the ASG. Sometimes we add something, or adjust something, but it would still the recommended structure.
Director of Architecture, Chief Architect at Briebug. Google GDE for Angular/Web Tech. I’m a huge weather nerd. I’m here if you need help in Angular, ASP.Net Core, or best practices.
Location
USA
Education
School of Hard Knocks
Work
Director of Architecture, Chief Architect at Briebug
That’s great! I am a big fan of the style guide. I use it as a base for most things, but I do on occasion break from the norm where it makes sense for my team and our deliverables. Have a great day!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm surprise for this recommendations. There are not only against the Angular Style Guide, but it require extra work from your team if you are using Angular CLI, or any UI that uses the CLI underneath. I would like to give my feedback about this, I hope you don't mind.
I find the router module to be very useful, you could even use it for the components that you are routing, as they are not supposed to be used else where.
Guards are just another kind of services, and thus they should be placed in the CoreModule, if you are using them as app wide services. I do like the idea of placing feature specific guards aside that feature module. However, if you place them all in CoreModule, you can use them in any part of the application, even in features modules.
In the same order of ideas, barrer files are discourage by the Angular Team, but for a good reason: They are not good for tree shaking. Also, they could produce circular dependency errors, but this is really unlikely.
Finally, and I guess this would be the most banal feedback, I wouldn't name a folder with a leading underscore, but I understand that with this you can find those folders better.
Thanks for the feedback Michael. I appreciate your opinion! It is always great to get feedback on articles that I write.
The concepts laid out in my article are recommendations and preferences. I realize others may not wish to implement ideas in the same manner, and that's OK.
I use the Angular CLI exclusively and these best practices work great with the CLI.
That being said, I would like to counter your claims with the following:
On Barrel index.ts exports: John Papa and Todd Motto both use barrel exports heavily, it's where I got the idea from. You can see their repos here using barrels: github.com/johnpapa/heroes-angular... and Todd's tweet for reference: twitter.com/toddmotto/status/91881...
On Folders with leading underscore: This is just a recommendation, and it works fantastic for my team. I have not run across any negative consequences from this. It's quite common out in the wild with several high starred github repos using this.
On Guards - I agree they are a type of service, but they have very unique use-cases, and can only be used directly with route definition. This is why I store them close to the source of use.
And again thanks for the feedback. I always appreciate it! Hope you’re having a great day!
I have admiration for both, but I also have found that this patterns doesn't fit with Angular very well. They are more like React, or Vue. You can use them, but they don't fit. I don't know if I explain myself. However, it's like you said, sometimes, sometimes not.
Well thanks again for your feedback! Would love to see how you’re building Angular apps for comparison sake. Maybe I’m missing something. If you haven’t already, how about writing an article?
Sure do. I have already write a couple, but nothing specific to organization structure, as I have found the Angular Style Guide a really good approach to manage. I have work in a couple of projects with Angular, and in all of them we always followed the ASG. Sometimes we add something, or adjust something, but it would still the recommended structure.
That’s great! I am a big fan of the style guide. I use it as a base for most things, but I do on occasion break from the norm where it makes sense for my team and our deliverables. Have a great day!