Skip to content

Commit 360df7d

Browse files
committed
fix readme #177
1 parent 86429dd commit 360df7d

File tree

2 files changed

+10
-46
lines changed

2 files changed

+10
-46
lines changed

README.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,10 @@ import { JsonSchemaFormModule } from '@dashjoin/json-schema-form';
5555
}
5656
```
5757
58-
`
59-
Note: You need import CommonModule for nested lazy loading modules
60-
`
61-
```typescript
62-
import { CommonModule } from '@angular/common';
63-
import { JsonSchemaFormModule } from '@dashjoin/json-schema-form';
64-
65-
@NgModule({
66-
...
67-
imports: [
68-
CommonModule,
69-
JsonSchemaFormModule,
70-
...
71-
],
72-
...
73-
}
74-
````
75-
7658
A small sample component:
7759
7860
```typescript
79-
import { Component } from '@angular/core';
61+
import { Component, OnInit } from '@angular/core';
8062
import { State } from '@dashjoin/json-schema-form';
8163
import { FormArray } from '@angular/forms';
8264

@@ -86,7 +68,7 @@ import { FormArray } from '@angular/forms';
8668
<lib-json-schema-form [state]="state"></lib-json-schema-form>
8769
`
8870
})
89-
export class AppComponent {
71+
export class AppComponent implements OnInit {
9072

9173
state: State = {
9274
schema: {
@@ -99,17 +81,17 @@ export class AppComponent {
9981
}
10082
}
10183
},
102-
value: any = [{
84+
value: [{
10385
name: 'Joe',
10486
bday: '2018-09-09T22:00:00.000Z'
105-
}];
87+
}],
10688
name: 'myform',
10789

10890
// pick FormArray, FormGroup or FormControl for arrays, objects, or single values respectively
10991
control: new FormArray([])
11092
};
11193

112-
foo() {
94+
ngOnInit(): void {
11395
// subscribe to form value change / validation or state events
11496
this.state.control.valueChanges.subscribe(res => {
11597
console.log(res);

projects/dashjoin/json-schema-form/README.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,10 @@ import { JsonSchemaFormModule } from '@dashjoin/json-schema-form';
5555
}
5656
```
5757
58-
`
59-
Note: You need import CommonModule for nested lazy loading modules
60-
`
61-
```typescript
62-
import { CommonModule } from '@angular/common';
63-
import { JsonSchemaFormModule } from '@dashjoin/json-schema-form';
64-
65-
@NgModule({
66-
...
67-
imports: [
68-
CommonModule,
69-
JsonSchemaFormModule,
70-
...
71-
],
72-
...
73-
}
74-
````
75-
7658
A small sample component:
7759
7860
```typescript
79-
import { Component } from '@angular/core';
61+
import { Component, OnInit } from '@angular/core';
8062
import { State } from '@dashjoin/json-schema-form';
8163
import { FormArray } from '@angular/forms';
8264

@@ -86,7 +68,7 @@ import { FormArray } from '@angular/forms';
8668
<lib-json-schema-form [state]="state"></lib-json-schema-form>
8769
`
8870
})
89-
export class AppComponent {
71+
export class AppComponent implements OnInit {
9072

9173
state: State = {
9274
schema: {
@@ -99,17 +81,17 @@ export class AppComponent {
9981
}
10082
}
10183
},
102-
value: any = [{
84+
value: [{
10385
name: 'Joe',
10486
bday: '2018-09-09T22:00:00.000Z'
105-
}];
87+
}],
10688
name: 'myform',
10789

10890
// pick FormArray, FormGroup or FormControl for arrays, objects, or single values respectively
10991
control: new FormArray([])
11092
};
11193

112-
foo() {
94+
ngOnInit(): void {
11395
// subscribe to form value change / validation or state events
11496
this.state.control.valueChanges.subscribe(res => {
11597
console.log(res);

0 commit comments

Comments
 (0)