简体   繁体   中英

Angular Cli with ASP NET MVC

Do you know how to implement Angular/Cli (Angular 4) with ASP NET MVC. I made a lot of things and nothing, i can not install it, if you know please help me.

It's difficult to achieve, purely because the @angular/cli relies heavily on webpack. It's designed to be much more standalone, at dev time at least. So you have two options available to you: embrace the separation, or integrate webpack dev server into ASP.NET as middleware.

If you take the former option, you'll just start them up separately, and then when you deploy the application - will copy the output html, css and javascript into the /public or /assets directory of your mvc site. (Typically as a part of your build pipeline.

Alternatively, if you can use aspnet core (which I would recommend), you can use the JavascriptServices package by the core team and they take care of the hard plumbing for you. It's pretty cool, you should check it out:

https://github.com/aspnet/JavaScriptServices http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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