简体   繁体   中英

Angular2 with IIS and without Node.js

I've been googling around for a few days, and I am still not entirely clear on what would be required for building an Angular2 website.

I am interested in leveraging the SPA concept, using the Angular2 library from the front end GUI, but I am finding there are more and more layers to this onion.

Of relevant tutorials I have found, the first step was to install node.js. My understanding of node.js is that it's essentially an IIS replacement. We currently are on a MS stack, with a lot of WCF, and Rest services (some that return JSON). Our team all uses TFS, and Nuget, and VS 2015.

Can I simply create a SPA in ASP.NET MVC, that uses Angular2, and calls these Rest services directly without going through node.js, and needing to know how NPM work? I was hoping that Angular2 was fairly simple, but it seems like it has a lot of strings attached (or I am looking at the wrong resources).

I guess one option would be to just go node.js, and ignore IIS entirely? This would be a huge leap for the MS stack team I work with and systems team that are MS/IIS friendly.

Thanks

You do need to install node and learn to use npm to develop with Angular 2. However node is not simply a web framework. It happens to be the tool of choice for client-side web tooling (not only Angular 2). You can run on IIS just fine and power the Angular 2 app with ASP.NET Web API but you need to compile your TypeScript, you need to bundle your scripts and manage these dependencies. This is what you need node and npm (and a bunch of other tools you get via npm) for. Don't worry there is no need to develop the server code in node or even install node on your server. Think of node as your MSBuild + PowerShell and of npm as your Nuget.

Warning - Angular 2 is still a RC and it is not entirely stable and especially the know-how on how to setup things is still less than ideal. It is even worse when you want to do things on the MS ecosystem not because it can't be done but because not many people have documented the steps.

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