- Added DynamicField interface to define form field structure. - Created DynamicFormConfig interface for form configuration. - Developed DynamicFormComponent to handle dynamic form rendering and validation. - Implemented DynamicPopupComponent for displaying forms in a modal dialog. - Added HTML and SCSS for dynamic form and popup styling. - Integrated Material Design components for form inputs and buttons. - Implemented form submission logic with API integration. - Added tests for DynamicForm and DynamicPopup components. - Updated global styles for Material components in themed popups. - Included Material Icons in index.html for better UI representation.
25 lines
441 B
TypeScript
25 lines
441 B
TypeScript
import { Injectable, signal, computed } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class LoaderService {
|
|
|
|
private _requestCount = signal(0);
|
|
|
|
// computed loader state
|
|
isLoading = computed(() => this._requestCount() > 0);
|
|
|
|
increase() {
|
|
this._requestCount.update(c => c + 1);
|
|
}
|
|
|
|
decrease() {
|
|
this._requestCount.update(c => Math.max(0, c - 1));
|
|
}
|
|
|
|
reset() {
|
|
this._requestCount.set(0);
|
|
}
|
|
}
|