Skip to main content

Your first angular app

As we have installed angular CLI in previous article now we can create a new angular project. So back to the terminal
Let's call this project hello_world.

~$ng new hello_world 
here is my practice screen-  also i'm not mac user๐Ÿ˜‰


So this will generates a bunch of files and folders and then it going to use NPM to download third party libraries.
So our project is successfully created, now to start coding we need a code editor. the editor i'm gonna use for practice is visual studio code or vs code it's beautiful, cross-platform and light-weight editor, you can download it from code.visualstudio.com  .
If you dont like this editor feel free to use any editor that you prefer, we can use sublime, atom or any other editors, if you gonna use vs code i want you to add it to the path so you can easily open it from the terminal. Open vs code here if you are using mac press shift+cmd+p or if you are using wind๐Ÿ˜‰ws press shift+ctrl+p this opens-up the command palette now here type-
          code     and you will get intellisense 
"install 'code' command in PATH". with this we can go to the terminal in the folder where we created a new project hello-world
Simply type
                       ~$hello-world $code .   
So this opens up vs code pointing to the current folder. In the next article we gonna look at the structure, you gonna learn what files and folders we have here but before we get there let's make sure that this application works.
So back in the terminal once again we use angular CLI to load our application in the web server so type in the terminal
~ng serve


So now we have a live development server listening on localhost:4200 and angular CLI also compiles our application it generates bundles for javascript and css files.
It's time to test our application
Open chrome and hit the url localhost:4200 
Beautiful... this is our first angular app.
In next artical we will look at the structure of the new angular project... 
see you s๐Ÿ˜๐Ÿ˜n.

Comments

Popular posts from this blog

Setting Up the Development Environment

In this article i'm gonna show you how to setup your development envirnoment and create your first angular project. The first thing you need to install is the latest version of the  node , if you have never worked with node before, it's basically a runtime envirnoment for executing javascript code outside the browser. Here in angular we are not going  to work with node but node provides some tools that we need to build angular projects. For installation of node just go to nodejs.org  on this page you can see the latest version of node for your operating system here in my case the latest stable version is v8.9 and the latest version is v9.5 now this latest  version has more features but its not stable yet so just go ahead and install the latest stable version v8.9 when you do that open up the terminal on mac or command prompt on windows (let me show you few commands) and type  ~ $node --version (on mac๐Ÿ‘ˆ๐Ÿ˜‰)  v8.9.4 so you can see on my machine i'm run...

Structure of Angular Projects

In our last session we created a project now let's see what files and folders we have in this new project. The first folder we have in our project hello-world is -  (See the screens of package.json here๐Ÿ˜Š) package.json e2e :- you just expand it and you will see a bunch files there. e2e which stands for end to end and this is where we write end to end tests for our application. If you have not worked with e2e tests let me tell you that these are basically automated tests that simulate a real user, so we can write code to launch our browser, navigate to the homepage of our application, click a links, fill out a form, click a button and then assert that there is something on a page, this is an example of e2e tests, it comes in picture when you learn angular well, so just for now dont w๐Ÿ˜Šrry about it. node_modules - so below e2e we have node_modules and this is where you store all the third party libraries that our application may depend upon. keep in mind that this ...