How to generate UUID with angular 2? -
i'm using angular 2 signup form: first name, last name, email , password.
after submit, data being stored via api call in database (nodejs , mongo) , generates jwt token sent client.
now should add/generate uuid (universal unique identifier). never have done kind of feature before, need approach , idea/solution how achieve this... jwt token kind of alternative uuid? if yes, enough.
otherwise prefer avoid big changes on form or functionality.
i have been searching, didn't find useful solution. tried npm package angular2-uuid
, after installing dependency, ng build -prod
throws error isn't clear.
`import { uuid } 'angular2-uuid'; .... let uuid = uuid.uuid();`
any idea or hint please?
try (https://github.com/wulfsolter/angular2-uuid
)
as doc :
import { uuidservice } 'angular2-uuid'; constructor(private uuid: uuidservice) //<-- pass in contructor service const uuid = this.uuid.generate(); //<-- use
hope helps you! ..as can see changed little bit report here (https://www.npmjs.com/package/angular2-uuid)
Comments
Post a Comment