Browse Source

refactor(identity): roles save button

pull/2146/head
mehmet-erim 7 years ago
parent
commit
d22e6b9b7b
  1. 6
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html
  2. 10
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

6
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html

@ -106,7 +106,7 @@
</ng-template>
<ng-template #abpBody>
<form [formGroup]="form" (ngSubmit)="save()">
<form #formRef [formGroup]="form" (ngSubmit)="save()" validateOnSubmit>
<div class="form-group">
<label for="role-name">{{ 'AbpIdentity::RoleName' | abpLocalization }}</label
><span> * </span>
@ -133,7 +133,9 @@
<button type="button" class="btn btn-secondary" #abpClose>
{{ 'AbpIdentity::Cancel' | abpLocalization }}
</button>
<abp-button iconClass="fa fa-check" (click)="save()">{{ 'AbpIdentity::Save' | abpLocalization }}</abp-button>
<abp-button iconClass="fa fa-check" (click)="onClickSaveButton()">{{
'AbpIdentity::Save' | abpLocalization
}}</abp-button>
</ng-template>
</abp-modal>

10
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

@ -1,6 +1,6 @@
import { ABP } from '@abp/ng.core';
import { ConfirmationService, Toaster } from '@abp/ng.theme.shared';
import { Component, TemplateRef, ViewChild, OnInit } from '@angular/core';
import { Component, TemplateRef, ViewChild, OnInit, ContentChild, ElementRef } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { Select, Store } from '@ngxs/store';
import { Observable } from 'rxjs';
@ -40,8 +40,8 @@ export class RolesComponent implements OnInit {
sortKey = '';
@ViewChild('modalContent', { static: false })
modalContent: TemplateRef<any>;
@ViewChild('formRef', { static: false, read: ElementRef })
formRef: ElementRef<HTMLFormElement>;
constructor(private confirmationService: ConfirmationService, private fb: FormBuilder, private store: Store) {}
@ -122,4 +122,8 @@ export class RolesComponent implements OnInit {
.pipe(finalize(() => (this.loading = false)))
.subscribe();
}
onClickSaveButton() {
this.formRef.nativeElement.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
}
}

Loading…
Cancel
Save