Creating desktop apps using Angular 2 – Updated.

Hi Friends,

Hope you are all well. This is a response to most of our friends requesting me to update the Creating desktop apps using Angular 2 post here. Now that Angular 2.0 is out (Finally..!!) I decided to provide you all with an updated repo in this post.

Let’s begin.

A screencast of this post


The complete code for this tutorial is available here.

First of all, I would recommend you go through the previous post on creating desktop apps using Angular 2 here. I would also suggest you to watch the video once here.

This post would just have instructions on how to update that repo to the latest version of Angular 2. So kindly grab a copy of that repo here.

Okay, let’s get started.

First of all. You would probably know that Angular 2 introduced NgModules from the RC.5 version. So let’s first update our app to work with modules as well.

Open up the app directory and create a new file called app.module.ts and add the below code in it.

Then create another file called app.component.ts and add the below code.

Okay. Now go ahead and remove the app.ts file since it is not needed anymore.

Come out of the app directory and create a file called main.ts in the main project directory and add the below code in it.

This will bootstrap our angular app nicely. Note that we have imported a file called polyfills.ts let’s go ahead and create that in our project as well.

Create a file called polyfills.ts and add the below lines into it.

Okay. Simply run npm install once and give the below command to build the app.

Once this runs successfully, then give the below command to run the app.

If everything goes fine you would see a screen as the one shown below.



That’s it. Now you have an updated version.

Hope this helped you folks. Thanks for reading. Have a nice day. Peace.. :)

Liked it? Take a second to support admin on Patreon!