mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-04-19 23:02:33 +00:00
37 lines
824 B
TypeScript
37 lines
824 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class FuseUtilsService
|
|
{
|
|
/**
|
|
* Constructor
|
|
*/
|
|
constructor()
|
|
{
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// @ Public methods
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* Generates a random id
|
|
*
|
|
* @param length
|
|
*/
|
|
randomId(length: number = 10): string
|
|
{
|
|
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
let name = '';
|
|
|
|
for ( let i = 0; i < 10; i++ )
|
|
{
|
|
name += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
}
|
|
|
|
return name;
|
|
}
|
|
}
|