Angular 2.0

This tutorial will guide you through the steps required to get Node.js and Angular 2.0 setup installed on your windows system in order to begin development with Angular 2.0 web applications. The setup is fairly simple, so there shouldn’t be too much room for things to go wrong. This is what you need to do to setup node.js and angular 2.0 for development on windows. For setup on Linux, the process is quite similar, but the commands will differ.

Install Node.js and NPM

You can download this from the official node.js website. It is a simple installer. Make sure you install the “npm package manager” as part of the node.js install. Click here to download Node.js from the official website. 

Once you have this installed, you should be able to use it right away without needing to restart your PC, but you should test it out first to make sure. Open command prompt and run the following 2 commands to make sure that node.js and npm are correctly installed with the path variables setup.

You now have the means to get started.

Install Typescript for Angular 2.0

Typescript is what is used for Angular 2.0 development. You can install this using npm. Run the following command inside the windows command prompt to install typescript.

And thats is, you now have your system setup to begin developing applications with node.js and Angular 2.0. To make sure everything works, here are some extra steps to setup a simple project.

Creating a Test Project

You should try keep all of your development under 1 main directory. Make sure that the command prompt is open as an administrator and run the following commands to setup a development area on the C drive.

You now have the directory setup and ready to store a test project. You will now need set this directory up in order to correctly host an Angular2.0 project.

In order to get a project going you need to setup a config file for typescript in the root of the project folder. This needs to be created for each project. You can create it manually each time once you get familiar with what needs to go inside. For now you can run the following command to build it.

Navigate to your testproject directory and you will see that there is now a file in this folder called tsconfig.json. Open this file up and add some additional lines to it. Modify the file so that it contains the following content.

From the command prompt, make sure you are in the same directory as the tsconfig.json file. Once here, run the following command.

You will get some prompts from the window asking you to enter information. The default information will suffice for most of it. Once complete, you will now have a file called package.json inside of the project directory. Open up this file and add some additional data, your file should be structured more like this when you are finished.

From the same project directory as before, run the following command to install all of the project dependencies.

This will take a few minutes to complete, once it finishes you will be ready to add some components to your app.

Create Angular 2.0 Hello World

This part is easy and not so easy. Particularly if you are doing everything manually. Rather than explain it all, there is actually a very good example on the official website that will explain how to get a simple hello world style application setup and running. Click here for the official quick start guide on the angular website. 

 

Sharepoint Logo

This tutorial will show you how to programmatically create a subsite in Sharepoint. This can be done a few different ways and if you have server access you may prefer to do this on the server side, but you can just as easily create one using the Client-Side Object Model.

You can do this using a standard C# console application. For this example I used Visual Studio 2013 with .NET 4.0. You will need to include 2 assemblies in order for the code to work.

If this code throws an error then you will need to add the reference to your project. For me, I was not able to find Microsoft.Sharepoint but when I added the .client assembly it worked.

Thats it! The code above is all you need to create a new subsite. If you make a mistake and want to change it, you can also do this quite easy using similar code. You can modify pretty much everything on a subsite, but the URL becomes read only so you cannot change this once it has been set.

This is all you need to be able to add a subsite and to be able to edit it.

The default command prompt doesn’t allow for users to copy and paste text to and from the command shell. This can be really annoying if you don’t know how to get around this. In order to copy and paste content from a command shell window you can right click on the shell and use the mark option. This is not nearly as good as actually being able to copy and paste normally. Using mark will cause the line breaks to show up in place of the word wrapping.

Right click on the open window and select “mark”.
You will now be able to highlight text using your mouse cursor.
Once you have it selected, right click on the text and it will be saved to the clip board.

 

mark shell window