具有多个Angular 2应用程序的ASP.Net Core MVC [英] ASP.Net Core MVC With Multiple Angular 2 Applications

查看:69
本文介绍了具有多个Angular 2应用程序的ASP.Net Core MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我知道会变得越来越复杂的项目准备结构.我想将ASP.Net Core MVC用于顶层导航.我想在每个主视图中放置一个Angular 2应用程序.

I am trying to prepare the structure for a project which I know will grow in complexity. I want to use ASP.Net Core MVC for the top level navigation. Within each of the main Views I want to place an Angular 2 Application.

我已经开始使用此Yoman模板来搭建起点

I have started with this Yoman template to scaffold out a starting point Angular 2 with ASP.Net Core Template. This built and ran well.

在我的项目的根目录中,我想有一个AngularApps文件夹,并且在每个Angular App的文件夹中都有一个计划",实用程序",设备".

In the root of my project I want to have an AngularApps folder and within that a folder for each Angular App, say 'Scheduling', 'Utilities', 'Equipment'.

有几个我无法理解的问题:

There are a couple problems I cannot understand:

  1. 如何配置Webpack?
  2. AngularApps中是否有一个dist文件夹?
  3. 每个Angular 2应用程序在其各自的应用程序文件夹中是否都有一个boot-clientboot-server文件?
  1. How do I configure Webpack?
  2. Do I have a single dist folder within AngularApps?
  3. Do I have a boot-client and boot-server file for each Angular 2 application within its respective app folder?

在我看来,务实的方法是从一开始就计划拥有多个Angular 2应用程序,每个应用程序的职责都更加集中.但是,我找不到任何有关如何实际进行这项工作的明确示例.我相信这对许多人来说都是有价值的.

It seems to me a pragmatic approach to plan from the beginning to have multiple Angular 2 applications, each with a more focussed responsibility. I cannot find any clear examples of how to practically make this work though. I'm sure this would be valuable for many people.

非常感谢.

推荐答案

我们在公司遇到了同样的问题,并提出了这种结构.

We had the same issue at our company and came up with this structure.

我们有一个ASP.NET Core的主项目,像您一样...在您的情况下,我们有一个名为apps或AngularApps的根文件夹.然后,我们为开发的每个有角度的应用程序创建了单独的项目.这些Angular应用程序中的每一个都是基本节点项目,我们使用Angular CLI进行构建以进行项目开发.这包括Webpack以及适用于您的项目的许多其他出色工具.

We have one master project for ASP.NET Core, and like you... we have the root folder named apps or AngularApps in your case. We then created separate projects for each angular app we developed. Each of these Angular apps are basic node projects that we use Angular CLI to build to project. This includes Webpack and a host of other great tools for your project.

最后,在生产"构建设置中,我们将这些角度项目的输出目录设置为主ASP.NET Core Project的wwwroot文件夹中的特定文件夹.

Finally, in the Production build settings, we made our output directory of these angular projects set to a specific folder in the wwwroot folder of our master ASP.NET Core Project.

希望对您有所帮助.

这篇关于具有多个Angular 2应用程序的ASP.Net Core MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆