How to pass two parameters per url in angle 5?

1

I'm trying to pass two parameters by url in angle 5 but it does not leave me, I'm doing it like that

 let administrador = this.usuario.admin

 let username = this.usuario.username

 this._http.get('http://localhost/api/public/archivo/admin/${administrador},
 ${username}',{headers:headers}).subscribe(data=>{

 }.....

Any solution?

    
asked by ortiga 15.03.2018 в 19:51
source

2 answers

1

Response to the original question

A Literal Template or Text chain templates must be encapsulated by "backticks" or inverted commas in this way

'texto ${variable}'

Otherwise it will take everything as text ignoring the variables

    
answered by 16.03.2018 / 00:25
source
2

I do not know if it will help, but I think that to refer to that variable in the .ts file, you do not need to put it between {}, apart from referring to the value that the administrator contains in the html , it would be with double in this way - > {{administrator}}

So to take the administrator variable in the place you are placing it would be enough to remove the {}. Although I'm not entirely sure, since I'm also fighting with ionic currently. Apart from that the second variable you are not placing it divided with "/", but you are placing it ","

Still to know if the requests are made correctly I recommend you use Postman, this can help you a lot.

    
answered by 15.03.2018 в 20:12