Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 앵귤러 애니메이션
- 옵저버블
- angular animation
- angular route
- flex-1
- mysql if
- 셀렉트박스 커스텀
- egov spring ajax 사용 예시
- modal
- Router
- route
- angular modal
- formgroup
- summary
- prisma
- Ionic modal
- Angular Router
- TAILWIND
- 스크롤 이벤트
- 앵귤러 모달
- 검색
- 모달
- 호버
- 스크롤 이벤트 감지
- angular button
- 아이오닉 스크롤 이벤트
- Oracle LISTAGG 사용 예시
- ajax 사용 예시
- scroll
- ApexChart
Archives
- Today
- Total
깜놀하는 해므찌로
Angular 의존성 주입 예시 본문
반응형
SMALL
@Component({ … })
class HeroListComponent {
constructor(private service: HeroService) {}
}
의존성 객체를 주입하는 방법 중 가장 많이 사용하는 방법은 클래스 생성자에서 의존성 객체를 요청하는 것입니다. Angular는 컴포넌트나 디렉티브, 파이프 클래스의 인스턴스를 생성할 때 생성자에 등록된 객체의 타입을 보고 어떤 의존성 객체가 필요한지 결정합니다. HeroListComponent가 HeroService를 요청하는 경우라면 HeroListComponent의 생성자는 이렇게 지정합니다:
반응형
LIST
'IT' 카테고리의 다른 글
typescript abstract, extends 추상 클래스 활용 예시 (0) | 2023.05.26 |
---|---|
git submodule / submodule add 방법 예시 (0) | 2023.05.26 |
Uncaught (in promise): NullInjectorError: R3InjectorError(Standalone[LayoutPage])[HttpService -> HttpService -> HttpService -> HttpClient -> HttpClient]: 에러 해결 (0) | 2023.05.25 |
typescript static 정적 변수 활용 예시 (0) | 2023.05.25 |
Tailwind 단어 단위 줄바꿈 CSS (0) | 2023.05.24 |