This commit is contained in:
parent
d3915fda9f
commit
f031683a9a
|
@ -49,19 +49,17 @@ export class AutocompleteRemoteComponent implements OnInit, ControlValueAccessor
|
||||||
|
|
||||||
|
|
||||||
updateByQuery(query : string){
|
updateByQuery(query : string){
|
||||||
if(query){
|
this.serverService.getThroughProxy(this.url, query).subscribe(
|
||||||
this.serverService.getThroughProxy(this.url, query).subscribe(
|
response => {
|
||||||
response => {
|
this.values.length = 0; //clear array; -- this is quite a fast and memory efficient way
|
||||||
this.values.length = 0; //clear array; -- this is quite a fast and memory efficient way
|
response.data.forEach(element => {
|
||||||
response.data.forEach(element => {
|
this.values.push(element.attributes.name);
|
||||||
this.values.push(element.attributes.name);
|
});
|
||||||
});
|
},
|
||||||
},
|
error => {
|
||||||
error => {
|
console.log(error);
|
||||||
console.log(error);
|
}
|
||||||
}
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,9 +48,11 @@ export class RestBase {
|
||||||
|
|
||||||
public proxy_get_wQuery(path : string, query: string, params? : any){
|
public proxy_get_wQuery(path : string, query: string, params? : any){
|
||||||
var options = this.createOptions(params);
|
var options = this.createOptions(params);
|
||||||
return this.http.get<any>(this.proxyPath +"proxy?url="+ path+"?search="+query, options);
|
var queryPart = (query) ? "?search="+query : "";
|
||||||
|
return this.http.get<any>(this.proxyPath +"proxy?url=" + path + queryPart, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public login(path : string, data : any){
|
public login(path : string, data : any){
|
||||||
let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') };
|
let options = { headers: new HttpHeaders().set('Content-Type', 'application/json') };
|
||||||
return this.http.post<any>(this.loginPath + path, JSON.stringify(data), options);
|
return this.http.post<any>(this.loginPath + path, JSON.stringify(data), options);
|
||||||
|
|
Loading…
Reference in New Issue