diff --git a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts index 51d55dc83..7f3472761 100644 --- a/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts +++ b/src/Squidex/app/features/schemas/pages/schema/forms/field-form-common.component.ts @@ -5,7 +5,7 @@ * Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. */ -import { Component, Input, OnChanges } from '@angular/core'; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; import { FieldDto } from '@app/shared'; @@ -15,7 +15,7 @@ import { FieldDto } from '@app/shared'; styleUrls: ['field-form-common.component.scss'], templateUrl: 'field-form-common.component.html' }) -export class FieldFormCommonComponent implements OnChanges { +export class FieldFormCommonComponent implements OnChanges, OnInit { @Input() public editForm: FormGroup; @@ -28,7 +28,7 @@ export class FieldFormCommonComponent implements OnChanges { @Input() public field: FieldDto; - public ngOnChanges() { + public ngOnInit() { this.editForm.setControl('isRequired', new FormControl(this.field.properties.isRequired)); @@ -47,4 +47,10 @@ export class FieldFormCommonComponent implements OnChanges { this.editForm.setControl('label', new FormControl(this.field.properties.label)); } + + public ngOnChanges(changes: SimpleChanges) { + if (changes['field']) { + this.editForm.reset(this.field.properties); + } + } } \ No newline at end of file diff --git a/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts b/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts index 72ea6e45d..0722c02ba 100644 --- a/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts +++ b/src/Squidex/app/features/settings/pages/roles/roles-page.component.ts @@ -67,7 +67,7 @@ export class RolesPageComponent implements OnInit { if (value) { this.rolesState.add(value) .subscribe(() => { - this.addRoleForm.submitCompleted(); + this.addRoleForm.submitCompleted({}); }, error => { this.addRoleForm.submitFailed(error); });