Skip to content

Commit

Permalink
Closes matiboy#28
Browse files Browse the repository at this point in the history
  • Loading branch information
matiboy committed Feb 25, 2018
1 parent a71cacf commit 192451a
Showing 1 changed file with 3 additions and 27 deletions.
30 changes: 3 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ e.g. `systemjs.config.js`:

## Usage

Import PrettyJsonModule to have access to following component and pipes
Import PrettyJsonModule to have access to the component and pipes
```js
import {PrettyJsonModule} from 'angular2-prettyjson';

Expand Down Expand Up @@ -81,30 +81,6 @@ outputs

![4 spaces](https://cloud.githubusercontent.com/assets/487758/15599411/a6815a8e-2415-11e6-8f1f-e68db77885a2.png)

#### Overriding JsonPipe throughout the app

If you want the Safe Pipe to be used throughout the app:

```js
import {PrettyJsonModule, SafeJsonPipe} from 'angular2-prettyjson';
import {JsonPipe} from '@angular/common';

@NgModule({
declarations: [
AppComponent,
],
imports: [
PrettyJsonModule,
],
providers: [
{ provide: JsonPipe, useClass: SafeJsonPipe }
],
bootstrap: [AppComponent]
})
export class AppModule {
}
```

### Pretty (and safe) Pipe

The `PrettyJsonPipe` stringifies the object and then adds spans around properties, `null`, arrays etc. You can bind it to the innerHtml of other elements.
Expand Down Expand Up @@ -154,12 +130,12 @@ The `PrettyJsonPipe` stringifies the object and then adds spans around propertie

Takes an input `[obj]` that can be data bound to any object.

Make sure `PrettyJsonModule` is imported in your own module.

```js
import {PrettyJsonComponent} from 'angular2-prettyjson';

@Component({
....
entryComponents: [PrettyJsonComponent], // Add to entry components
template: `
<prettyjson [obj]="theForm.value"></prettyjson>
`
Expand Down

0 comments on commit 192451a

Please sign in to comment.