문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| angular:service [2019/03/02 10:10] – [HttpClient] taekgu | angular:service [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| - | ===== Service ===== | + | ====== Service |
| - | A class with a specific purpos. | + | |
| - | - Share data | + | **Angular**는 // |
| - | - Implement application logic | + | <wrap em> |
| - | - External Interaction | + | - 데이타 공유 |
| - | Naming convention - .service.ts | + | - 응용프로그램 로직 구현 |
| - | <code javascript> | + | - 외부 접속창구 역할 |
| + | </ | ||
| + | ===== Sample ===== | ||
| + | <code javascript | ||
| import { Injectable } from ' | import { Injectable } from ' | ||
| - | // @Injectable({ | + | @Injectable({ |
| - | // providedIn: ' | + | |
| - | // }) | + | }) |
| - | @Injectable() | + | |
| export class EmployeeService { | export class EmployeeService { | ||
| 줄 29: | 줄 31: | ||
| ==== HttpClient ==== | ==== HttpClient ==== | ||
| [[angular: | [[angular: | ||
| - | <code javascript> | + | <code javascript |
| import { Injectable } from ' | import { Injectable } from ' | ||
| import { HttpClient, HttpErrorResponse } from ' | import { HttpClient, HttpErrorResponse } from ' | ||
| 줄 37: | 줄 39: | ||
| import { catchError, retry } from ' | import { catchError, retry } from ' | ||
| - | // @Injectable({ | + | @Injectable({ |
| - | // providedIn: ' | + | |
| - | // }) | + | }) |
| - | @Injectable() | + | |
| export class EmployeeService { | export class EmployeeService { | ||
| private _url: string = "/ | private _url: string = "/ | ||