blob: 3d4b9859ed74fd099b0514731ce8f568c7f12435 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { Injectable } from '@angular/core';
@Injectable()
export class MaasService {
constructor() { }
generateUniqueId(): string {
const timestamp = new Date().getTime();
const randomNum = Math.floor(Math.random() * 1000000);
return `${timestamp}${randomNum}`;
}
updateCharCount(textarea: HTMLTextAreaElement, charCount: HTMLElement) {
const charCountValue = textarea.value.length;
const maxLength = textarea.getAttribute('maxlength');
charCount.innerText = `${charCountValue}/${maxLength}`;
}
}
|