Skip to content

Commit

Permalink
Merge pull request #220 from zakhenry/feat/optional-disabled
Browse files Browse the repository at this point in the history
feat(Disabled): Permit root forms to omit the disabled option, defaul…
  • Loading branch information
zak-cloudnc authored Jun 23, 2021
2 parents b3e9ec1 + d1f95c1 commit 8d9e3ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion projects/ngx-sub-form/src/lib/ngx-sub-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function createForm<ControlInterface, FormInterface>(
ControlInterface,
FormInterface
>(options)
? options.disabled$
? options.disabled$ ?? EMPTY
: componentHooks.setDisabledState$;

const transformedValue$: Observable<FormInterface> = writeValue$.pipe(
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-sub-form/src/lib/ngx-sub-form.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export type NgxRootFormOptions<ControlInterface, FormInterface = ControlInterfac
ControlInterface,
FormInterface
> & {
disabled$: Observable<boolean>;
input$: Observable<ControlInterface | undefined>;
output$: Subject<ControlInterface>;
disabled$?: Observable<boolean>;
// by default, a root form is considered as an automatic root form
// if you want to transform it into a manual root form, provide the
// following observable which trigger a save every time a value is emitted
Expand Down

0 comments on commit 8d9e3ce

Please sign in to comment.