How to generate UUID with angular 2?

后端 未结 3 647
野的像风
野的像风 2021-01-31 08:45

I\'m using Angular 2 for a signup form: first name, last name, email and password.

After submit, the data is being stored via API call in a database (nodeJs and mongo) a

3条回答
  •  面向向阳花
    2021-01-31 09:07

    try this (https://github.com/wulfsolter/angular2-uuid)

    As the doc say :

    import { UuidService } from 'angular2-uuid';
    
    constructor(private uuid: UuidService) //<-- pass it in contructor as service
    
    const uuid = this.uuid.generate(); //<-- use it
    

    Hope it helps you! ..as you can see it changed a little bit from what it report here (https://www.npmjs.com/package/angular2-uuid)

提交回复
热议问题