## Response
使用指定值創建`Response`實例。
Though this object isn't usually instantiated by end-users, it is the primary object interacted with when it comes time to add data to a view.
```typescript
http.request('my-friends.txt').subscribe(response => this.friends = response.text());
```
The Response's interface is inspired by the Response constructor defined in the Fetch Spec, but is considered a static value whose body can be accessed many times. There are other differences in the implementation, but this is the most significant.
### 類定義
```typescript
class Response extends Body {
constructor(responseOptions: ResponseOptions)
type : ResponseType
ok : boolean
url : string
status : number
statusText : string
bytesLoaded : number
totalBytes : number
headers : Headers
toString() : string
}
```
### 屬性
- type : `ResponseType`
“basic", "cors", "default", "error" 或者 "opaque", 默認為 "default"
- ok : `boolean`
如果響應狀態在200-299內為`True`
- url : `string` 響應URL, 默認為空字符串
- status : `number` 服務器返回的狀態碼,默認為200
- statusText : `string` Text representing the corresponding reason phrase to the status, as defined in [ietf rfc 2616 section 6.1.1](https://tools.ietf.org/html/rfc2616#section-6.1.1),默認為"OK"
- bytesLoaded : `number`
Non-standard property
Denotes how many of the response body's bytes have been loaded, for example if the response is the result of a progress event.
totalBytes : `number`
Non-standard property
Denotes how many bytes are expected in the final response body.
headers : `Headers`
Headers object based on the Headers class in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class).
toString() : `string`
- 說明
- angular 1.x
- ngModelController
- ngOptions
- ngModelOptions
- lifecycle
- directive
- angular 2
- @angular/forms
- 類
- AbstractControl
- AbstractControlDirective
- AbstractFormGroupDirective
- FormControl
- FormArray
- FormBuilder
- FormGroup
- NgControl
- 接口
- controlValueAccessor
- 指令
- DefaultValueAccessor
- Angular 2 生命周期
- OnInit
- DoCheck
- @angular/router
- 配置
- Routes
- 指令
- RouterOutlet
- RouterLink
- 接口
- ActivatedRoute
- UrlTree
- NavigationExtras
- ActivatedRouteSnapshot
- RouterStateSnapshot
- 類
- UrlSegment
- UrlSegmentGroup
- UrlSerializer
- DefaultUrlSerializer
- Router
- bug記得
- @angular/http
- 類
- Http
- Body
- Response
- ResponseOptions
- Header
- Request
- RequestOptions
- URLSearchParams
- @angular/core
- decorator
- Component-decorator
- animation
- DI
- linker
- TemplateRef
- ElementRef
- EmbeddedViewRef
- ViewRef
- ViewContainerRef
- Query
- ComponentFactory
- ComponentRef
- Renderer
- change_detection
- KeyValueDiffers
- IterableDiffers
- ChangeDetectorRef
- ChangeDetectionStrategy
- Zone
- ngZone
- @angular/common
- 指令
- NgTemplateOutlet
- QueryList
- bootstrap4
- card
- form
- 重點關注博客
- 學習過的文章
- 筆記
- Angular 2 雙向綁定
- 將字符串解析成DOM
- rx相關
- operators
- combineLatest
- combineAll
- concat(All, Map, *MapTo)
- 背壓(backpressure)
- js事件keycode對應表
- 裝飾器
- 有用的代碼摘錄
- 日期操作
- 數量操作
- 字符操作
- rxjs問題
- 小示例
- h5面試準備
- react
- 開發遇到的問題