0

我是 Angular 的新手,并试图在 Asp Net Core 项目中使用它。然而; 我找不到一个好的模板开始。此外,我无法将 Angular 4 模板放入现有的 ASP Net Core 和 Angular templatepack 中。文件结构让我抓狂!Asp Net Zero 是一个很好的入门工具包,但我买不起。我对谷歌进行了很好的研究,但我无法得到一个好的答案。是否有任何其他模板或入门工具包,显然不那么专业,可以让我开始使用 Asp Net Core 在 Angular 中编码?感谢您的回答!

4

2 回答 2

2

我发现 Yeoman ASP.NET Core 单页应用程序生成器 (generator-aspnetcore-spa) 是一个很好的起点。

npm install npm@latest -g
npm install -g yo
npm install -g yo generator-aspnetcore-spa
yo aspnetcore-spa

Telerik 有一个很好的方法:http ://www.telerik.com/blogs/cooking-with-aspnet-core-and-angular-2

*上面的howto说Angular 2,但是生成器更新为4。

于 2017-07-20T23:21:59.567 回答
2

我尝试了@john-mccann 的答案,但是这个生成器已被弃用,这里的消息是:

$ yo aspnetcore-spa
## Please use "dotnet new" templates instead

As of .NET Core 2.0, it's no longer necessary to use Yeoman to create new 
Single-Page Application projects.

Using the .NET Core 2.0 SDK, you can run any of the following commands in an empty directory, without needing to install any external packages first:

* dotnet new angular
* dotnet new react
* dotnet new redux

Or, if you want to create an Aurelia, Knockout, or Vue application, you should run dotnet new --install Microsoft.AspNetCore.SpaTemplates::* first. This will add aurelia, knockout, and vue templates to dotnet new.

### This Yeoman generator is DEPRECATED

Please don't use generator-aspnetcore-spa to create new projects. Its output is outdated and no longer maintained. Instead, use dotnet new as described above (or if you're on Windows and use Visual Studio, you can just use File->New Project to create Angular, React, or React+Redux projects).

之后,我尝试了这个

$dotnet new angular

并且可以正常工作

$ dotnet new angular
$ dotnet restore
$ npm install
于 2017-09-16T20:17:08.777 回答