简体   繁体   English

哪个是最好的 Angular 4 架构?

[英]Which is the best Angular 4 architecture?

I am writing a "social network" app with Angular 4 (typescript) and Angularfire and I have this problem:我正在使用 Angular 4(打字稿)和 Angularfire 编写一个“社交网络”应用程序,但我遇到了这个问题:

Now I have a single app.routing module that makes possible to navigate through 5 main pages (example home, settings, profile and so on).现在我有一个 app.routing 模块,可以浏览 5 个主要页面(例如主页、设置、配置文件等)。 I would like to implement inside each page multiple "dashboard like" components.我想在每个页面内实现多个“类似仪表板”的组件。 I want that each component to have the possibility to route inside the self component.我希望每个组件都有可能在 self 组件内部进行路由。 For example例如

App.component -route-> home.component App.component -route-> home.component

home component will has 2 components inside called with and home 组件内部将有 2 个组件,使用和调用

Inside comp1 I would like to be able to change the content of it with a button and route inside of it maintaining the other home components the same:在 comp1 中,我希望能够使用按钮更改它的内容,并在其中路由保持其他 home 组件相同:

Is it possible?是否可以?

Searching on the web I found some examples with named outlet or component with a custom module declared.在网上搜索我发现了一些带有命名插座或带有自定义模块的组件的示例。

Has somebody some GitHub source or examples?有人有一些 GitHub 源代码或示例吗? Or, I'd like to have some suggestions for the best architecture app.或者,我想对最佳架构应用程序提出一些建议。

Thanks谢谢

Check Angular's guide for lazy-loaded modules.查看 Angular 的延迟加载模块指南。 Lazy loaded modules have their own routing: https://angular.io/guide/ngmodule#lazy-loading-modules-with-the-router But if you don't want to use lazy loading, child routes may be enough for you: https://angular.io/guide/router#child-route-configuration延迟加载模块有自己的路由: https : //angular.io/guide/ngmodule#lazy-loading-modules-with-the-router但是如果你不想使用延迟加载,子路由可能就足够了: https://angular.io/guide/router#child-route-configuration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM