4

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

1
  • 1
    Node is mostly used for tooling, and development. You can use any server when you finish the app. If you don't want to use node you can write code in JavaScript, but you'll be missing TypeScript, CSS preprocessors like LESS, SASS, Stylus, script bundlers... etc. Commented Jun 16, 2016 at 21:36

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

4 Comments

This is a fantastic response, very clear and helpful, thanks!
Node + npm is a starter pack for every web developer nowadays. Moreover, most of the tools out there that can enhance you productivity are npm friendly.
First hurdle, trying to run npm install -g typescript gives me a SELF_SIGNED_CERT_IN_CHAIN error. And so the fun begins!
Agreed with your warning, I am finding out that there are no good tutorials that seem to work. This one for example (angular.io/docs/ts/latest/cookbook/visual-studio-2015.html) fails miserably for me on the package restore on the packages.json step, the npm burps up 30 lines of incohernt ERR messages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.