How to generate UUID in Angular

Nothing to do with Angular itself, you can get uuid from one of the popular npm package such as this:

https://www.npmjs.com/package/uuid

The code looks like this:

import * as uuid from 'uuid';

const myId = uuid.v4();

However, the uuid package does not define a uuid class (type); it just provides utilities for generating and parsing UUIDs as strings, and for converting between string and byte array representations. So you will not be able to use the type system to ensure that values are valid UUIDs.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)