0

I am working on a project in which i've to get string value in (GUID) need to convert in to GUID

Format of the query string is already in GUID but ofcourse when we do take value from query string using angularJS and typescript it's return in to string.

How i can convert that string to GUID.

URL:

https://localhost:44326/search?criteria=apparel&categoryId=c24dee00-ba9d-4af5-b357-a5b20033e5a7

typescript/Angular Code

export class Test
{
 categoryId: System.Guid;

init(): void {
     this.categoryId = this.queryString.get("categoryId");
   }
}

When this Init() get execute, I am getting error and categoryId set to emtpy without setting up query string value.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
HPP
  • 244
  • 2
  • 12

1 Answers1

0

I am working on a project in which i've to get string value in (GUID) need to convert in to GUID

There is no native GUID type in JavaScript / TypeScript. You are best left representing it as a string.

More

If you are concerned for tracking all the guids you can do

type GUID = string; 

Or even some of the nominal typing tricks.

basarat
  • 261,912
  • 58
  • 460
  • 511