티스토리 뷰
반응형
SPA(Single Page Application) 인 Angular는 자신의 라우터링크를 누르면
아무 반응이 없는데 이 대신 새로고침으로 하게 하는 편법이 있다.
import { Router, NavigationEnd } from '@angular/router';
ngOnInit(){
this.router.routeReuseStrategy.shouldReuseRoute = function(){
return false;
};
this.router.events.subscribe((evt) => {
if (evt instanceof NavigationEnd) {
this.router.navigated = false;
window.scrollTo(0, 0);
}
});
}
참조 :
반응형
'FrontEnd > Angular' 카테고리의 다른 글
Angular Security - Sanitization (0) | 2018.07.09 |
---|---|
라우터 파라미터 (0) | 2018.07.04 |
Angular select (0) | 2018.06.22 |
angular style (0) | 2018.06.18 |
VSCode로 Angular 디버깅하기 (0) | 2018.06.14 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- jQuery
- https://www.tistory.com/auth/logout/
- Router
- data component module
- Redux
- JPA
- MySQL
- Angular
- Spring Boot
- 파이썬3
- 파이썬
- python3
- JSON
- react
- data component
- data gird component
- angular router
- Python
- localStorage
- data grid component
- React-router
- data table component
- 페이스북 로그인
- Java
- CSS
- Spring
- facebook login
- JavaScript
- mobx
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
글 보관함