Monday, October 1, 2018

Work with Angular

Create a Component

To create component,
1. first  create folder as component.(This is optional . using folder we can make clean & clear
   project ).
2.open terminal.
3.run command ng generate component [component name] .( short form => ng g c [component name]).











4.Now open home u can see
  •  home.component.css 
  •  home.component.html 
  •  home.component.spec.cs
  •  home.component.ts     
5. Open home.component.ts and get word phase in selector

  @Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {

  constructor() { }
  ngOnInit() {
  }

}

6. Add selector to app.component.html
    
7. Rerun project  and see in your browser . you can see
       home work!




No comments:

Post a Comment