Skip to content

Commit cf243e0

Browse files
Update README.md
- minor style and grammar adjustments
1 parent a69e17c commit cf243e0

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -914,19 +914,19 @@ You can download the PDF and Epub version of this repository from the latest run
914914
915915
31. ### What is a custom pipe?
916916
Apart from built-in pipes, you can write your own custom pipe with the below key characteristics:
917-
1. A pipe is a class decorated with pipe metadata **@Pipe** decorator, which you import from the core Angular library
917+
1. A pipe is a class decorated with pipe metadata `@Pipe` decorator, which you import from the core Angular library
918918
For example,
919919
```javascript
920920
@Pipe({name: 'myCustomPipe'})
921921
```
922922
2. The pipe class implements the **PipeTransform** interface's transform method that accepts an input value followed by optional parameters and returns the transformed value.
923-
The structure of pipeTransform would be as below,
923+
The structure of `PipeTransform` would be as below,
924924
```javascript
925925
interface PipeTransform {
926926
transform(value: any, ...args: any[]): any
927927
}
928928
```
929-
3. The @Pipe decorator allows you to define the pipe name that you'll use within template expressions. It must be a valid JavaScript identifier.
929+
3. The `@Pipe` decorator allows you to define the pipe name that you'll use within template expressions. It must be a valid JavaScript identifier.
930930
```javascript
931931
template: `{{someInputValue | myCustomPipe: someOtherValue}}`
932932
```
@@ -961,10 +961,9 @@ You can download the PDF and Epub version of this repository from the latest run
961961
**[⬆ Back to Top](#table-of-contents)**
962962
963963
34. ### What is a bootstrapping module?
964-
Every application has at least one Angular module, the root module that you bootstrap to launch the application is called as bootstrapping module. It is commonly known as AppModule. The default structure of AppModule generated by AngularCLI would be as follows,
965-
966-
```javascript
967-
/* JavaScript imports */
964+
Every application has at least one Angular module, the root module that you bootstrap to launch the application is called as bootstrapping module. It is commonly known as `AppModule`. The default structure of `AppModule` generated by AngularCLI would be as follows:
965+
966+
```javascript
968967
import { BrowserModule } from '@angular/platform-browser';
969968
import { NgModule } from '@angular/core';
970969
import { FormsModule } from '@angular/forms';
@@ -986,7 +985,7 @@ You can download the PDF and Epub version of this repository from the latest run
986985
bootstrap: [AppComponent]
987986
})
988987
export class AppModule { }
989-
```
988+
```
990989
991990
**[⬆ Back to Top](#table-of-contents)**
992991
@@ -996,7 +995,7 @@ You can download the PDF and Epub version of this repository from the latest run
996995
**[⬆ Back to Top](#table-of-contents)**
997996
998997
36. ### What is HttpClient and its benefits?
999-
Most of the Front-end applications communicate with backend services over HTTP protocol using either XMLHttpRequest interface or the fetch() API. Angular provides a simplified client HTTP API known as **HttpClient** which is based on top of XMLHttpRequest interface. This client is avaialble from `@angular/common/http` package.
998+
Most of the Front-end applications communicate with backend services over `HTTP` protocol using either `XMLHttpRequest` interface or the `fetch()` API. Angular provides a simplified client HTTP API known as `HttpClient` which is based on top of XMLHttpRequest interface. This client is avaialble from `@angular/common/http` package.
1000999
You can import in your root module as below,
10011000
10021001
```javascript
@@ -1012,9 +1011,9 @@ You can download the PDF and Epub version of this repository from the latest run
10121011
10131012
**[⬆ Back to Top](#table-of-contents)**
10141013
1015-
37. ### Explain on how to use HttpClient with an example?
1016-
Below are the steps need to be followed for the usage of HttpClient.
1017-
1. Import HttpClient into root module:
1014+
37. ### Explain on how to use `HttpClient` with an example?
1015+
Below are the steps need to be followed for the usage of `HttpClient`.
1016+
1. Import `HttpClient` into root module:
10181017
```javascript
10191018
import { HttpClientModule } from '@angular/common/http';
10201019
@NgModule({
@@ -1027,8 +1026,8 @@ You can download the PDF and Epub version of this repository from the latest run
10271026
})
10281027
export class AppModule {}
10291028
```
1030-
2. Inject the HttpClient into the application:
1031-
Let's create a userProfileService(userprofile.service.ts) as an example. It also defines get method of HttpClient
1029+
2. Inject the `HttpClient` into the application:
1030+
Let's create a userProfileService(`userprofile.service.ts`) as an example. It also defines get method of `HttpClient`:
10321031
```javascript
10331032
import { Injectable } from '@angular/core';
10341033
import { HttpClient } from '@angular/common/http';
@@ -1045,7 +1044,7 @@ You can download the PDF and Epub version of this repository from the latest run
10451044
}
10461045
```
10471046
3. Create a component for subscribing service:
1048-
Let's create a component called UserProfileComponent(userprofile.component.ts) which inject UserProfileService and invokes the service method,
1047+
Let's create a component called UserProfileComponent(`userprofile.component.ts`), which injects `UserProfileService` and invokes the service method:
10491048
```javascript
10501049
fetchUserProfile() {
10511050
this.userProfileService.getUserProfile()
@@ -1061,20 +1060,20 @@ You can download the PDF and Epub version of this repository from the latest run
10611060
**[⬆ Back to Top](#table-of-contents)**
10621061
10631062
38. ### How can you read full response?
1064-
The response body doesn't may not return full response data because sometimes servers also return special headers or status code which are important for the application workflow. Inorder to get full response, you should use observe option from HttpClient,
1063+
The response body doesn't or may not return full response data because sometimes servers also return special headers or status code, which are important for the application workflow. In order to get the full response, you should use `observe` option from `HttpClient`:
10651064
10661065
```javascript
10671066
getUserResponse(): Observable<HttpResponse<User>> {
10681067
return this.http.get<User>(
10691068
this.userUrl, { observe: 'response' });
10701069
}
10711070
```
1072-
Now HttpClient.get() method returns an Observable of typed HttpResponse rather than just the JSON data.
1071+
Now `HttpClient.get()` method returns an Observable of typed `HttpResponse` rather than just the `JSON` data.
10731072
10741073
**[⬆ Back to Top](#table-of-contents)**
10751074
10761075
39. ### How do you perform Error handling?
1077-
If the request fails on the server or failed to reach the server due to network issues then HttpClient will return an error object instead of a successful reponse. In this case, you need to handle in the component by passing error object as a second callback to subscribe() method.
1076+
If the request fails on the server or fails to reach the server due to network issues, then `HttpClient` will return an error object instead of a successful reponse. In this case, you need to handle in the component by passing `error` object as a second callback to `subscribe()` method.
10781077
10791078
Let's see how it can be handled in the component with an example,
10801079
```javascript
@@ -1086,7 +1085,7 @@ You can download the PDF and Epub version of this repository from the latest run
10861085
);
10871086
}
10881087
```
1089-
It is always a good idea to give the user some meaningful feedback instead of displaying the raw error object returned from HttpClient.
1088+
It is always a good idea to give the user some meaningful feedback instead of displaying the raw error object returned from `HttpClient`.
10901089
10911090
**[⬆ Back to Top](#table-of-contents)**
10921091

0 commit comments

Comments
 (0)