penambahan icon pada master category

This commit is contained in:
2024-06-25 21:54:12 +07:00
parent fc9947da15
commit 89203b9984
11 changed files with 164 additions and 45 deletions

View File

@@ -2,6 +2,7 @@
[items]="icons"
bindLabel="name"
(change)="onSelect($event)"
[(ngModel)]="selectedIcon"
bindValue="icon"
placeholder="Select an icon"
>

View File

@@ -1,4 +1,4 @@
import { Component, EventEmitter, Output } from "@angular/core";
import { Component, EventEmitter, Input, Output } from "@angular/core";
import { MasterService } from "../../service/master-api.service";
interface Icon {
name: string;
@@ -10,7 +10,9 @@ interface Icon {
styleUrls: ["./select-icon.component.css"],
})
export class SelectIconComponent {
@Output() iconSelected: EventEmitter<string> = new EventEmitter<string>();
// @Output() iconSelected: EventEmitter<string> = new EventEmitter<string>();
@Output() iconSelected = new EventEmitter<string>();
@Input() selectedIcon: string;
icons: any[] = [];
constructor(private masterService: MasterService) {}
ngOnInit(): void {
@@ -20,6 +22,12 @@ export class SelectIconComponent {
}
onSelect(icon: Icon): void {
this.iconSelected.emit(icon.icon);
console.log(icon);
if (icon) {
this.iconSelected.emit(icon.icon);
} else {
this.iconSelected.emit(undefined);
}
}
}