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 사용 예시
- formgroup
- 앵귤러 애니메이션
- flex-1
- scroll
- ApexChart
- 스크롤 이벤트
- angular modal
- 검색
- route
- angular animation
- Angular Router
- 셀렉트박스 커스텀
- mysql if
- prisma
- 옵저버블
- Router
- angular button
- egov spring ajax 사용 예시
- angular route
- summary
- 호버
- Ionic modal
- modal
- 앵귤러 모달
- TAILWIND
- ajax 사용 예시
- 모달
- 아이오닉 스크롤 이벤트
- 스크롤 이벤트 감지
Archives
- Today
- Total
깜놀하는 해므찌로
Angular route config 가져와서 사용하기 예시 본문
반응형
SMALL
import { Route } from '@angular/router';
import { LayoutPage } from './pages/layout/layout.page';
export const appRoutes: Route[] = [
{
path: '',
title: '테스트',
component: LayoutPage,
children: [
{
path: '',
title: '테스트 - 홈',
data: { menu: false },
loadComponent: () =>
import('./pages/index/index.page').then((m) => m.IndexPage),
},
{
path: 'video',
title: '테스트 - 영상',
data: {
menu: true, // true => 메뉴로써 사용, false => 메뉴로써 사용 X
label: '영상',
icon: 'assets/icon/video.svg',
title: 'Video',
},
children: [
{
path: '',
loadComponent: () =>
import('./pages/video/video.page').then((m) => m.VideoPage),
},
{
path: 'portfolio',
title: '테스트 영상 포트폴리오',
data: {
menu: true,
label: '테스트 영상 포트폴리오',
icon: '',
title: 'portfolio',
},
loadComponent: () =>
import('./pages/video/portfolio/portfolio.page').then(
(m) => m.PortfolioPage
),
},
],
},
],
},
];
1. appRoutes 파일 예시
import { Route, Router, RouterModule } from '@angular/router';
menus: Route[] | undefined;
constructor(private readonly router: Router) {
this.menus = router.config[0].children?.filter(
(route) => route.data?.['menu']
);
}
2. 생성자로 의존성 주입 후 router.config 접근
반응형
LIST
'IT' 카테고리의 다른 글
Angular External Url / 앵귤러 외부 url 요청 예시 / 앵귤러 새창열기 (0) | 2023.05.22 |
---|---|
Tailwind 버튼 클릭 효과 / 버튼 클릭 시 커졌다 작아지는 효과 (0) | 2023.05.22 |
typescript literal type / 리터널 타입 / intersection type / 교차 타입 / |, & (0) | 2023.05.22 |
typescript 복수 타입 인자, 복수 리턴 타입, 함수 오버로드, typescript function overload (0) | 2023.05.21 |
typescript this 활용 예시 (0) | 2023.05.20 |