Sunday, March 17, 2019

Getting Started with Angular 5

Based on:

https://www.udemy.com/angular-5/

https://github.com/paulchin/ng5


Good reference from the horse's mouth:

   https://angular.io/guide/quickstart

To install:

   npm instal -g @angular/cli

To check version after installation:

   ng -v

To the help options:

   ng

To create a new project:

   cd ProjectFolder
   ng new ng5 --style=scss --routing

ng5 is the name of your new app.

To run app:

   cd ng5
   ng serve

To generate a new component:

   ng generate component home
 
You can also use short hand, to generate component:

   ng g c about

An alternative to templateUrl:

@Component({
selector: 'app-home',
template: `
<p>This is my html</p>
`,
styleUrls: ['./home.component.scss']
})

An alternative to styleUrls:

@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styles: [
`
p {
font-weight: bold;
}
div {
color: gray;
}
`
]
})


Enjoy

No comments:

Post a Comment