Skip to content

Commit

Permalink
chore(Readme): Update readme with updated source code
Browse files Browse the repository at this point in the history
  • Loading branch information
zak-cloudnc committed Oct 18, 2021
1 parent 99c7c2f commit 8f72aec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ If you have custom validations on the form controls, implement the `NgxFormWithA
Example:

```ts
// src/app/main/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts#L13-L76
// src/app/main/listing/listing-form/vehicle-listing/crew-members/crew-members.component.ts#L13-L78

interface CrewMembersForm {
crewMembers: CrewMember[];
Expand All @@ -425,7 +425,9 @@ export class CrewMembersComponent extends NgxSubFormRemapComponent<CrewMember[],
implements NgxFormWithArrayControls<CrewMembersForm> {
protected getFormControls(): Controls<CrewMembersForm> {
return {
crewMembers: new FormArray([]),
crewMembers: new FormArray([], {
validators: formControl => (formControl.value.length >= 2 ? null : { minimumCrewMemberCount: 2 }),
}),
};
}

Expand Down Expand Up @@ -479,10 +481,13 @@ export class CrewMembersComponent extends NgxSubFormRemapComponent<CrewMember[],
Then our view will look like the following:

```html
<!-- src/app/main/listing/listing-form/vehicle-listing/crew-members/crew-members.component.html#L1-L26 -->
<!-- src/app/main/listing/listing-form/vehicle-listing/crew-members/crew-members.component.html#L1-L28 -->

<fieldset [formGroup]="formGroup" class="container">
<legend>Crew members form</legend>
<legend>
Crew members form
<small>(Minimum 2)</small>
</legend>

<div
class="crew-member"
Expand Down

0 comments on commit 8f72aec

Please sign in to comment.