[Angular] 커스텀 프로퍼티 바인딩과 이벤트 바인딩
모든 컴포넌트의 프로퍼티는 해당하는 컴포넌트의 내부에서 접근 가능하다. 상위 컴포넌트에서 하위컴포넌트로 바인딩하는 형태이다. 즉 상위 컴포넌트가 하위 컴포넌트로 데이터를 전달 할 수 있다. 가령 이러한 코드가 있다면 app-test 컴포넌트에서 Input 을 사용하여 element를 받아야 한다. import { Component, Input } from '@angular/core'; @Component({ selector: 'app-test', templateUrl: './app-test.component.html', styleUrls: ['./app-test.component.css'] }) export class AppComponent { @Input() element; } 이런식으로 @Input ..
카테고리 없음
2022. 3. 18. 16:01