Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 511
Efrain Perez Avatar asked Mar 09 '23 02:03

Efrain Perez


1 Answers

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/

like image 200
mikegeyser Avatar answered Mar 19 '23 17:03

mikegeyser