본문 바로가기

개발/Web

화면 분리하기

해드 컴포넌트 생성

ng g component head

바디 컴포넌트 생성

 ng g component body

헤더와 바디 컴포넌트를 메인컴포넌트 파일에 등록(app.component.html)

<app-head></app-head>
<br>
<app-body></app-body>

헤더 셀렉터

import { Component, OnInit } from '@angular/core';

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

  constructor() { }

  ngOnInit(): void {
  }
}

바디 셀렉터

import { Component, OnInit } from '@angular/core';

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

  constructor() { }

  ngOnInit(): void {
  }
}

'개발 > Web' 카테고리의 다른 글

Angular 파일 구조 및 흐름  (0) 2020.04.02
Router(라우터)  (0) 2020.03.31
[Board] Start  (0) 2020.03.27
custom reuse strategy  (0) 2020.03.25
Data Display  (0) 2020.03.25