Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How to create GUID in angular-2?

in my application i need to create GUID, that GUID will be work as cookies, so anybody knows how to create GUID in angular-2/typescript or using any angular2 dependency/library.

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

You even can use npm to generate this for you. Follow this :

npm i guid-typescript --save

And to utilize in your code :

import { Guid } from 'guid-typescript';
export class GuidExample {
    public id: Guid;
    constructor() {
        this.id = Guid.create(); // ==> b77d409a-10cd-4a47-8e94-b0cd0ab50aa1
    }
}
about 4 years ago · Santiago Trujillo Report

0

Please refer to this link, or try this npm package.

about 4 years ago · Santiago Trujillo Report

0

You can use this code to generate your own GUID:

class GuidGenerator {
    static newGuid() {
      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
        var r = Math.random() * 16 | 0,
        v = c == 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
      });
    }
}
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!