File tree Expand file tree Collapse file tree 2 files changed +10
-46
lines changed
projects/dashjoin/json-schema-form Expand file tree Collapse file tree 2 files changed +10
-46
lines changed Original file line number Diff line number Diff 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-
7658A small sample component:
7759
7860` ` ` typescript
79- import { Component } from '@angular/core';
61+ import { Component , OnInit } from ' @angular/core' ;
8062import { State } from ' @dashjoin/json-schema-form' ;
8163import { 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 );
Original file line number Diff line number Diff 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-
7658A small sample component:
7759
7860` ` ` typescript
79- import { Component } from '@angular/core';
61+ import { Component , OnInit } from ' @angular/core' ;
8062import { State } from ' @dashjoin/json-schema-form' ;
8163import { 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 );
You can’t perform that action at this time.
0 commit comments