Skip to content
Snippets Groups Projects
Commit 6d22f9f8 authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-4995 Set `submitInProgress$` during construction

parent 86c499be
No related branches found
No related tags found
No related merge requests found
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core';
import { OrganisationseinheitFormservice } from './organisationseinheit.formservice'; import { OrganisationseinheitFormservice } from './organisationseinheit.formservice';
import { Observable, of, tap } from 'rxjs'; import { Observable, of, tap } from 'rxjs';
import { Organisationseinheit } from '../../../user/user.model'; import { Organisationseinheit } from '../../../user/user.model';
...@@ -8,7 +8,7 @@ import { Organisationseinheit } from '../../../user/user.model'; ...@@ -8,7 +8,7 @@ import { Organisationseinheit } from '../../../user/user.model';
templateUrl: './organisationseinheit-form.component.html', templateUrl: './organisationseinheit-form.component.html',
providers: [OrganisationseinheitFormservice], providers: [OrganisationseinheitFormservice],
}) })
export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit { export class OrganisationseinheitFormComponent implements AfterViewInit {
static CREATE_LABEL: string = 'Neue Organisationseinheit anlegen'; static CREATE_LABEL: string = 'Neue Organisationseinheit anlegen';
static EDIT_LABEL: string = 'Organisationseinheit bearbeiten'; static EDIT_LABEL: string = 'Organisationseinheit bearbeiten';
...@@ -17,7 +17,7 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit ...@@ -17,7 +17,7 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit
@ViewChild('OrganisationseinheitDialog') private dialogRef: ElementRef<HTMLDialogElement>; @ViewChild('OrganisationseinheitDialog') private dialogRef: ElementRef<HTMLDialogElement>;
dialog: HTMLDialogElement; dialog: HTMLDialogElement;
submitInProgress$: Observable<boolean>; submitInProgress$: Observable<boolean> = of(false);
label: string; label: string;
...@@ -27,10 +27,6 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit ...@@ -27,10 +27,6 @@ export class OrganisationseinheitFormComponent implements OnInit, AfterViewInit
this.dialog = this.dialogRef.nativeElement; this.dialog = this.dialogRef.nativeElement;
} }
ngOnInit(): void {
this.submitInProgress$ = of(false);
}
public submit() { public submit() {
this.submitInProgress$ = this.formService this.submitInProgress$ = this.formService
.submit() .submit()
......
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input } from '@angular/core';
import { PostfachFormService } from './postfach.formservice'; import { PostfachFormService } from './postfach.formservice';
import { isNotNil, ProblemDetail, StateResource } from '@alfa-client/tech-shared'; import { isNotNil, ProblemDetail, StateResource } from '@alfa-client/tech-shared';
import { PostfachResource } from '../../postfach.model'; import { PostfachResource } from '../../postfach.model';
...@@ -9,8 +9,8 @@ import { map, Observable, of } from 'rxjs'; ...@@ -9,8 +9,8 @@ import { map, Observable, of } from 'rxjs';
templateUrl: './postfach-form.component.html', templateUrl: './postfach-form.component.html',
providers: [PostfachFormService], providers: [PostfachFormService],
}) })
export class PostfachFormComponent implements OnInit { export class PostfachFormComponent {
submitInProgress$: Observable<boolean>; submitInProgress$: Observable<boolean> = of(false);
@Input() set postfachStateResource(stateResource: StateResource<PostfachResource>) { @Input() set postfachStateResource(stateResource: StateResource<PostfachResource>) {
this.updatePostfachResource(stateResource.resource); this.updatePostfachResource(stateResource.resource);
...@@ -26,10 +26,6 @@ export class PostfachFormComponent implements OnInit { ...@@ -26,10 +26,6 @@ export class PostfachFormComponent implements OnInit {
constructor(public formService: PostfachFormService) {} constructor(public formService: PostfachFormService) {}
ngOnInit(): void {
this.submitInProgress$ = of(false);
}
public submit(): void { public submit(): void {
this.submitInProgress$ = this.formService this.submitInProgress$ = this.formService
.submit() .submit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment