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
- Oracle LISTAGG 사용 예시
- mysql if
- egov spring ajax 사용 예시
- formgroup
- flex-1
- 옵저버블
- angular button
- ApexChart
- 스크롤 이벤트
- scroll
- angular route
- 앵귤러 애니메이션
- 검색
- prisma
- angular animation
- 셀렉트박스 커스텀
- Angular Router
- 앵귤러 모달
- 아이오닉 스크롤 이벤트
- route
- 모달
- 스크롤 이벤트 감지
- Ionic modal
- Router
- angular modal
- modal
- ajax 사용 예시
- summary
- 호버
- TAILWIND
Archives
- Today
- Total
깜놀하는 해므찌로
Angular icon component 예시 본문
반응형
SMALL
<ion-icon
[ngClass]="class"
[src]="name ? 'https://api.iconify.design/' + name + '.svg' : src"
/>
1. 템플릿
import { Component, HostBinding, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';
@Component({
selector: 'app-icon',
standalone: true,
imports: [CommonModule, IonicModule],
templateUrl: './icon.component.html',
styleUrls: ['./icon.component.scss'],
})
export class IconComponent {
@Input() name?: string | undefined;
@Input() src?: string | undefined;
@Input() class?: string | undefined;
@HostBinding('class') _class = 'flex';
}
2. name 과 src 를 주입 받아 사용합니다.
3. class 이름을 주입 받아 tailwind CSS 로 활용합니다.
<app-icon
name="ic:baseline-upload-file"
class="w-8 h-8 text-primary"
></app-icon>
4. 다른 컴포넌트에서 아이콘 컴포넌트를 사용하는 예시
반응형
LIST
'IT' 카테고리의 다른 글
Input type date appearance none 설정 예시 / date mark remove / date mark none (0) | 2023.06.21 |
---|---|
Angular 게시판 탭 Tab 예시 (0) | 2023.06.20 |
search box CSS 검색 박스 CSS 예시 (0) | 2023.06.19 |
Video width height 동영상 화면 비율 조정하기 CSS Tailwind / aspect-video (0) | 2023.06.19 |
Angular 데이터 길이만큼 배열 생성 (0) | 2023.06.19 |