Saturday 4 January 2020

Angular 8 Session 3: Creating Hello World App

Creating Hello World App

Here, we are creating a Hello World App for the 1st interaction with Angular.
Open a command prompt (node command prompt recommended), better to have in admin mode.
Create a new application.
ng new <<App Name>>       i.e. ng new Angular8Demo
To open the project in VS Code using command prompt.
Code . and hit enter
To compile and run the application.
ng  serve         // To compile / transpile the code
ng  serve --o   // To compile / transpile & run
     The default bootstrap component as per angular architecture is AppComponent.
app.component.ts
import { Component } from '@angular/core'; 
@Component({
  selector: 'app-root',
  templateUrl: './app.component2.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'Angular8Demo';
  myData = "Hello World";

}
app.component.html
<div align="center">
    <h1>{{"Welcome to "+myData+" Application"}}</h1>
</div>

No comments:

Post a Comment

Angular 8 Session 21 - ngFor Directive In Angular

ngFor Directive Content will be resume soon. Stay tuned!