1)


2)
컴포넌트 생성
ng g component world
app.component.html
<app-hello></app-hello>
<br>
<app-world *ngIf="visible"></app-world>
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
visible : boolean = true;
}
ng serve

visible을 false로 할 시에는 if문 때문에 app-world가 보이지 않는다.
'개발이 좋아서 > Angular가 좋아서' 카테고리의 다른 글
Angular - 튜토리얼06_컴포넌트, 모듈(로그인) (0) | 2022.09.28 |
---|---|
Angular - 튜토리얼05_컴포넌트, 모듈(로그인) (0) | 2022.09.28 |
Angular - 튜토리얼04_컴포넌트 (1) | 2022.09.27 |
Angular - 튜토리얼03 (2) | 2022.09.26 |
Angular - 튜토리얼02 (1) | 2022.09.26 |