can't use a variable as a parameter

user2843943

I'm trying to insert the parameters in this url but I can't get it to work. here is my code:

   filterFunction(newValue, parameter){
    this.workorderservice.searchWorkorders(1, 20, {sort: {}, search: {predicateObject: {'workorder.location.street': newValue}}, pagination: {start: 0}})

        .subscribe(data =>{ this.rows = data.json()
            this.links = this.parselink.parse(data.headers.get('link'))
            console.log(this.rows)
        })

}

I try to replace 'workorder.location.street' with parameter

Poul Kruijt

You cannot use a parameter name like that. Even though your question was a bit vague, I guess you should do this:

   filterFunction(newValue, parameter) {

     let predicateObject: any = {};
     predicateObject[parameter] = newValue;

     this.workorderservice.searchWorkorders(1, 20, {sort: {}, search: {predicateObject: predicateObject}, pagination: {start: 0}})

        .subscribe(data =>{ this.rows = data.json()
            this.links = this.parselink.parse(data.headers.get('link'))
            console.log(this.rows)
        })

    }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive