myura5
myura5

Reputation: 87

how to get parameter from query string in ionic?

I have some problem on getting parameter from query string. I'm trying using

import { URLSearchParams } from '@angular/http';

this.params = new URLSearchParams(window.location.search); this.params1 = this.params.getAll('param'); console.log('parameter: '+JSON.stringify(this.params1))

and when I'm try to access http://localhost:8100/param=1 it getting error Cannot GET /param=1

How can I get that param?

Upvotes: 0

Views: 1832

Answers (1)

myura5
myura5

Reputation: 87

Okay, i'm try using this.platform.getQueryParam('param'); and it working fine.

Upvotes: 1

Related Questions