Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71194

Removing quote marks from return values

$
0
0

@ejcabquina wrote:

Hi!

I’m trying to make a .ts file where the API URL is dynamic depending on the current user.

getCurrentUserData() {
    let apiUrl='apiurl.io/user';
    let data: Observable<any> = this.http.get(apiUrl+localStorage.getItem("uid")+'?_format=json');
    data.subscribe(result => {
      this.currentUserData = result;
      console.log(result);
    })
  }

I’m having problems with getting the proper URL.

I’m trying to get " apiurl.io/user/(uid)?_format=json’ ", but what i’m getting instead is " apiurl.io/user/"(uid)"?_format=json ".

I get the %22(uid)%22 and I’m guessing it’s because the stored value of uid is “1” with quotes instead of just the value 1.

Is there a way to format return values in .ts file?

or can anyone suggest an alternative solution? It is greatly appreciated.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 71194

Trending Articles