19

Getting Started with Angular 9

 4 years ago
source link: https://www.js-tutorials.com/angularjs-tutorial/getting-started-with-angular-9/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The Angular 9.0.0 version has been released now.This is a major release and have changes for entire platform, including the framework, Angular Material, and the CLI.

The Ivy compiler is default runtime compiler, Earlier it was optional parameter to select compiler under angular 8.They can Improved build errors that will helpful to debug errors in the application.

The angular 9 introduced two new component YouTube and Google Maps.You can include into your application and take benefit of those component.

There are following breaking changes for angular 9 –

tslib

Table of Contents

    • Setting up Angular CLI v
  • How To Create a New Angular 9 Project
    • How To Run Angular 9 Application
    • How To install Bootstrap 4
    • How To Create Component

Setting up Angular CLI v

You can install angular CLI by using following command, Open CMD in Administrator mode and run the following command.

// For Mac and Linux

sudo npm install -g @angular/cli

// For Windows

npm install -g @angular/cli

Now, run the following command to check the Angular CLI version.

ng version

How To Create a New Angular 9 Project

Let’s create a simple angular 9 application.Type the following command to create the new Angular 9 project –

ng new hello-angular9

The above CLI command will ask you two –

  • Would you like to add an Angular routing? Type y for Yes , n for NO
  • which stylesheet format would you like to use? Select CSS or other.

The above option use to add routing information into your application.You don’t need to add the routes for angular components to implement navigation in our application.You ll get app-routing.module.ts file inside the src >> app directory.

How To Run Angular 9 Application

I have created angular 9 application , Let’s run angular 9 application by running below command –

ng serve --open

The "–open" parameter will automatically open this Angular 9 app in the default browser.

The default URL is: http://localhost:4200

How To install Bootstrap 4

We will install bootstrap by using following command-

npm install bootstrap --save

Add the bootstrap css file inside an angular.json file.

"styles": [
   "src/styles.css",
   "./node_modules/bootstrap/dist/css/bootstrap.min.css"
 ],

How To Create Component

The Angular 9 CLI will use to create component. Type the following command to create the new component into the project –

ng g c employee-add --skipTests=true

The above command will create following files –

CREATE src/app/employee-add/employee-add.component.css (0 bytes)
CREATE src/app/employee-add/employee-add.component.html (25 bytes)
CREATE src/app/employee-add/employee-add.component.ts (290 bytes)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK