本文整理汇总了TypeScript中@angular/common/http.HttpParams.append方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpParams.append方法的具体用法?TypeScript HttpParams.append怎么用?TypeScript HttpParams.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common/http.HttpParams
的用法示例。
在下文中一共展示了HttpParams.append方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: runJob
/**
* Run job
* @param jarId
* @param entryClass
* @param parallelism
* @param programArgs
* @param savepointPath
* @param allowNonRestoredState
*/
runJob(
jarId: string,
entryClass: string,
parallelism: string,
programArgs: string,
savepointPath: string,
allowNonRestoredState: string
) {
const requestParam = { entryClass, parallelism, programArgs, savepointPath, allowNonRestoredState };
let params = new HttpParams();
if (entryClass) {
params = params.append('entry-class', entryClass);
}
if (parallelism) {
params = params.append('parallelism', parallelism);
}
if (programArgs) {
params = params.append('program-args', programArgs);
}
if (savepointPath) {
params = params.append('savepointPath', programArgs);
}
if (allowNonRestoredState) {
params = params.append('allowNonRestoredState', allowNonRestoredState);
}
return this.httpClient.post<{ jobid: string }>(`${BASE_URL}/jars/${jarId}/run`, requestParam, { params });
}
示例2: getCustomers
getCustomers(page?:number, size?:number): Observable<any> {
let me = this;
let params: HttpParams = new HttpParams();
params = params.append('page', typeof page === "number"? page.toString():"0");
params = params.append('size', typeof page === "number"? size.toString():"1000");
let customerListSubject = new Subject<any>(); // Will use this subject to emit data that we want
this.apiRequest.get('api/customers',params)
.subscribe(jsonResp => {
let items = jsonResp.items.map(function(v, i, a){
let newRow = Object.assign({}, v, {
address: `${v.address1}, <br/> ${v.city}, ${v.state} ${v.postalCode} <br/> ${v.country}`
});
return newRow;
});
let returnObj = Object.assign({},jsonResp,{
items:items
})
customerListSubject.next(returnObj); // incidentList is a Subject and emits an event thats being listened to by the components
});
return customerListSubject;
}
示例3: getPlan
/**
* Get plan json from jar
* @param jarId
* @param entryClass
* @param parallelism
* @param programArgs
*/
getPlan(jarId: string, entryClass: string, parallelism: string, programArgs: string) {
let params = new HttpParams();
if (entryClass) {
params = params.append('entry-class', entryClass);
}
if (parallelism) {
params = params.append('parallelism', parallelism);
}
if (programArgs) {
params = params.append('program-args', programArgs);
}
return this.httpClient.get<PlanInterface>(`${BASE_URL}/jars/${jarId}/plan`, { params }).pipe(
map(data => {
const links: VerticesLinkInterface[] = [];
let nodes: NodesItemCorrectInterface[] = [];
if (data.plan.nodes.length) {
nodes = data.plan.nodes.map(node => {
return {
...node,
detail: undefined
};
});
nodes.forEach(node => {
if (node.inputs && node.inputs.length) {
node.inputs.forEach(input => {
links.push({ ...input, source: input.id, target: node.id, id: `${input.id}-${node.id}` });
});
}
});
}
return { nodes, links };
})
);
}
示例4: sendAnswers
// resultID = ID der Feedback Kategorie
// resultAnswerArray = Array mit jeweils Question-ID und Question-Antwort
public sendAnswers(resultID:number, resultAnswersArray:string[][], config:IModuleConfig, token) {
var i;
var url = config.moodleServiceEndpoint;
var courseID = config.courseID;
var accessToken = config.authorization.credentials.authHeader.accessToken;
let headers:HttpHeaders = new HttpHeaders()
.append("Authorization", accessToken);
var params:HttpParams = new HttpParams()
.append("wstoken", token)
.append("wsfunction", "local_reflect_submit_feedbacks")
.append("moodlewsrestformat", "json")
.append("id", resultID.toString());
for (i = 0; i < resultAnswersArray.length; i++) {
var answerIDstring, answerString;
answerIDstring = "answers[" + i + "][id]";
answerString = "answers[" + i + "][answer]";
params = params.append(answerIDstring, resultAnswersArray[i][0]); // 0 = frage-id
params = params.append(answerString, resultAnswersArray[i][1]); // 1 = answer
}
params = params.append("courseID", courseID);
this.http.get(url, {headers:headers, params:params}).subscribe((data) => {
console.log(data);
});
}
示例5: loadAlbumPhoto
/**
* Load photos for specified album
* @param albumid ID of album
* @param accesscode Access code
* @param top Maximum amount of the photo to fetch
* @param skip The amount to skip in the result
*/
public loadAlbumPhoto(albumid: string | number, accesscode?: string, top?: number, skip?: number): Observable<any> {
let params: HttpParams = new HttpParams();
params = params.append('albumid', albumid.toString());
if (accesscode) {
params = params.append('accesscode', accesscode);
}
if (top) {
params = params.append('top', top.toString());
}
if (skip) {
params = params.append('skip', skip.toString());
}
let headers = new HttpHeaders();
headers = headers.append('Content-Type', 'application/json')
.append('Accept', 'application/json');
if (this._authService.authSubject.getValue().isAuthorized) {
headers = headers.append('Authorization', 'Bearer ' + this._authService.authSubject.getValue().getAccessToken());
return this._http.get(environment.PhotoAPIUrl, {
headers: headers,
params: params });
}
return this._http.get(environment.PhotoAPIUrl, {
headers: headers,
params: params,
});
}
示例6: generateAccessToken
generateAccessToken(verificationToken: string): Observable<OauthToken> {
let params = new HttpParams();
params = params.append('token', this.requestToken.token);
params = params.append('tokenSecret', this.requestToken.tokenSecret);
params = params.append('verificationToken', verificationToken);
return this.httpClient.get<OauthToken>(`${environment.apiUrl}/authentication/accessToken`, { params });
}
示例7: getEmployees
getEmployees(page?:number, size?:number): Observable<any> {
//Create Request URL params
let me = this;
let params: HttpParams = new HttpParams();
params = params.append('page', typeof page === "number"? page.toString():"0");
params = params.append('size', typeof page === "number"? size.toString():"1000");
return this.apiRequest.get('api/employees',params);
}
示例8: buscarProductos
public buscarProductos(filtro: any): Observable<any> {
let _baseUrl: string = Configuracion.API_URL + '/PlantillaVentas/BuscarProducto';
let params: HttpParams = new HttpParams();
params = params.append('empresa', Configuracion.EMPRESA_POR_DEFECTO);
params = params.append('filtroProducto', filtro);
return this.http.get(_baseUrl, { params: params })
.catch(this.handleError);
}
示例9: getProductos
public getProductos(cliente: string): Observable<any> {
let _baseUrl: string = Configuracion.API_URL + '/PlantillaVentas';
let params: HttpParams = new HttpParams();
params = params.append('empresa', Configuracion.EMPRESA_POR_DEFECTO);
params = params.append('cliente', cliente);
return this.http.get(_baseUrl, { params: params })
.catch(this.handleError);
}
示例10: leer
public leer(clave: string): Observable<any> {
let _baseUrl: string = Configuracion.API_URL + '/ParametrosUsuario';
let params: HttpParams = new HttpParams();
params = params.append('empresa', Configuracion.EMPRESA_POR_DEFECTO);
params = params.append('usuario', this.usuario.nombre);
params = params.append('clave', clave);
return this.http.get(_baseUrl, { params: params })
.catch(this.handleError);
}