Directory Image
This website uses cookies to improve user experience. By using our website you consent to all cookies in accordance with our Privacy Policy.

Getting Started with Angular 2 step by step : Your First Component

Author: First Enquiry
by First Enquiry
Posted: Aug 06, 2019

Why Should You Care?

The JavaScript and web world has changed a great deal since Angular JS was discharged. Angular 2 takes favorable circumstances of the considerable number of advances that have occurred from that point forward, grasps web norms and gets rid of a ton of develops that are currently local to Javascript, for example, modules,classes or decorators.

And not only that,it draws on all the teachings of tons of projects carried out by thousands of developers in AngularJS to provide a more consistent and compact developer experience.One with a reduced number of concepts to grasp and an easy-to-learn development model and syntax.

It is also faster,provides server-side rendering out of the box,is cross-platform,supports legacy browsers. etc

Angular 2 is the regular way ahead for all the AngularJS engineers out there and an incredible decision for those that welcome a stubborn system with a reasonable arrangement of defaults,focus on measured quality and testability.

Is Angular 2 Ready?

Angular 2 is ready indeed! since the initial publishing of this article Angular 2 has gone from beta, to RC, to final and now it is in its version 4.It is used not only by numerous companies but even extensive lt at Google in more than 200 projects including AdWords,GreenTea (Google's internal CRM system), Google Fiber and Google Cloud Platform.

The Code Samples

You can download the complete code samples for this blog post from this GitHub repo. You can likewise check the incredibly cool online supervisor Stackblitz which has wonderful suppoprt for composing Angular models on the web.My recommendation is that you follow the tutorial along using your own development environment,that way you get to enjoy the full Angular developer experience.But if you do not have time or energy to set it up right now, then try Stackblitz.

Getting Started with Angular 2 and Typescipt

The most ideal approach to begin learning Angular 2 and Typescript is to utilize the Angular CLI to bootstrap another task.

The Angular CLI is incredible in light of the fact that it incorporates all that you have to begin composing your Angular 2 application immediately: Afront-end fabricate pipeline to traspile your TypeScript into JavaScript that can keep running in the browser,lots of generators to platform your application, a web advancement server that naturally mirrors your adjustments in the programs as you make them and much more.I call that zero-grinding learning.

So start by installing the Angular CLI using npm ( you will need to install node.js and npm in your development machine before you can continue).In your terminal of chioce type :

PS> npm install -g @angular/cli

Presently you are prepared to utilize the Angular CLI to make another project.The direction that you use to get to the Angular CLI is ng.To make another application type the accompanying.

PS> ng new angular-get-started --style scss

This will make another Angular 2 venture sans preparation and set it up with the goal that you can utilize SASS as CSS preprocessor.If you go inside the angular-get-started folder that should have just been created you will find a folder structure that will look more or less like this :

// app source code (and specs)

-scr

-app # your app source code (and specs)

-assets # static assets like images, etc.

-index.html # the entry point to your app

-styles,scss # the global styles for your app

-environments #here you can define different environment configuration (prod,dev, etc).

//dependencies

  • node_modules# the source code of your app's dependencies
  • package.json# the manifest of your app that states all dependencies

//TypeScript configuration

-tsconfig,json # TypeScript compiler configuration

-tslint.json # TypeScript linting configuration

//Testing

-e2e #a folder with end to end tests

-karma.conf.js #karma test runner configuration

-protractor.conf.js # protractor e2e tests configuration

  • gitignore

-README.md

You can test everything works as it should by running the development server.Type the following command.

PS> ng serve --open

  • the short-hand syntax is : ng s -o

This should start the development server,open a browser and load your app.You can stop the server any time by typing CTRL-C a couple of times in the terminal.But for the time being just rejoice!You have created your first Angular 2 application!

#INDEX.HTML THE ENTRY POINT FOR YOUR APP

The index.html is the entry point to your application.

*It links to yours styles and javascript files

*It provides the HTML markup for your application with the custom element.

Select for Info Campus Software Training Centerand get trained with specialists.Find Angular 2 courses, classes in Marathahalli Bangalore at Infocampus with Real-Time Project Training, Hands-on Experience Mentors. 100% Placement Assistance after Immediate courses completion.

Visit:

http://infocampus.co.in/angulartwo-training-in-bangalore.html

To Book Free Demo,Please Call - 8884166608/9740557058/9738001024.

About the Author

Firstenquiry creates web development services as per the client requirements and prerequisites and help you to prevail in your own business. For more details contact: 8792462607 Web: https://www.firstenquiry.com/company

Rate this Article
Leave a Comment
Author Thumbnail
I Agree:
Comment 
Pictures
Author: First Enquiry

First Enquiry

Member since: Apr 16, 2018
Published articles: 92

Related Articles