dev
Last change
on this file since f3c4950 was f3c4950, checked in by Стојков Марко <mst@…>, 2 years ago |
Moderator can create categories
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | import { Component, OnInit } from '@angular/core';
|
---|
2 | import { FormControl, Validators, FormGroup } from '@angular/forms';
|
---|
3 | import { MatDialogRef } from '@angular/material/dialog';
|
---|
4 | import { CategoryFacadeService } from 'src/app/core/state/category-facade.service';
|
---|
5 | import { ButtonType } from 'src/app/shared-app/components/generic/button/button.models';
|
---|
6 |
|
---|
7 | @Component({
|
---|
8 | selector: 'app-create-category-dialog',
|
---|
9 | templateUrl: './create-category-dialog.component.html',
|
---|
10 | styleUrls: ['./create-category-dialog.component.scss']
|
---|
11 | })
|
---|
12 | export class CreateCategoryDialogComponent implements OnInit {
|
---|
13 | public ButtonType = ButtonType;
|
---|
14 | public textField = new FormControl('', [Validators.required, Validators.maxLength(500)]);
|
---|
15 | public formGroup: FormGroup;
|
---|
16 |
|
---|
17 | constructor(public dialogRef: MatDialogRef<CreateCategoryDialogComponent>, private categoryFacade: CategoryFacadeService) {
|
---|
18 | this.formGroup = new FormGroup({
|
---|
19 | text: this.textField
|
---|
20 | });
|
---|
21 | }
|
---|
22 |
|
---|
23 | ngOnInit(): void {}
|
---|
24 |
|
---|
25 | submit(): void {
|
---|
26 | this.categoryFacade.addNewCategory(this.textField.value);
|
---|
27 | this.dialogRef.close();
|
---|
28 | }
|
---|
29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.