Skip to content

Commit

Permalink
feat(Disabled): Permit root forms to omit the disabled option, defaul…
Browse files Browse the repository at this point in the history
…ting to an empty observable which will not disable the form
  • Loading branch information
zak-cloudnc committed Jun 23, 2021
1 parent aaefb64 commit d1f95c1
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 d1f95c1

Please sign in to comment.