当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript URLSearchParams.set方法代码示例

本文整理汇总了TypeScript中@angular/http.URLSearchParams.set方法的典型用法代码示例。如果您正苦于以下问题:TypeScript URLSearchParams.set方法的具体用法?TypeScript URLSearchParams.set怎么用?TypeScript URLSearchParams.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/http.URLSearchParams的用法示例。


在下文中一共展示了URLSearchParams.set方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: resetPassword

    resetPassword(uuid: string, newPassword: string): Promise<any> {
        if (!uuid || !newPassword) {
            return Promise.reject("Invalid reset uuid or password");
        }

        let body: URLSearchParams = new URLSearchParams();
        body.set("reset_uuid", uuid);
        body.set("password", newPassword);

        return this.http.post(resetPasswordEndpoint, body.toString(), HTTP_FORM_OPTIONS)
            .toPromise()
            .then(response => response)
            .catch(error => {
                return Promise.reject(error);
            });
    }
开发者ID:lengwei2018,项目名称:harbor,代码行数:16,代码来源:password-setting.service.ts

示例2: initCollection

 private initCollection(params){
     this.searchParams = params['collection_id'];
     let getParams = new URLSearchParams();
     getParams.set('populate', '_author+_thumbnail');
     this.isLoadingCollection = true;
     this.collectionService.getCollection(this.searchParams, getParams).subscribe((collection) => {
         this.collection = collection;
         this.titleService.setTitle(this.collection.title + ' | TidyCards');
         this.collection._items = [];
         if(this.authService.isLoggedIn && collection._author._id === this.authService.currentUser._id)
             this.isAuthor = true;
         this.isLoadingCollection = false;
         setTimeout( () => {
             $("#collectionDetailHeader").removeClass('is-hidden');
         }, 10);
         this.emitUpdateHeaderEvent();
         this.loadItems();
     }, (error) => {
         var errorBody = JSON.parse(error._body);
         var star = null
         if(errorBody.data)
             star = errorBody.data._star;
         if(star){
             this.collection = new TcCollection();
             this.collection._star = TcStar.createFormJson(star);
             this.cantFoundButwasStarred = true;
         }
         this.isLoadingCollection = false;
     });
 }
开发者ID:OlivierCoue,项目名称:invow,代码行数:30,代码来源:tc-collection-detail.component.ts

示例3: fetchSurvey

  fetchSurvey(id?: number): Observable<{}> {
    let headers: Headers = new Headers({ 'Content-Type': 'application/json' });
    let options: any = { headers: headers };
    let ReqOptions: RequestOptions;
    let search = new URLSearchParams();

    if (id) {
      search.set('id', '' + id);
      options.search = search;
    }

    ReqOptions = new RequestOptions(options);

    return this.http.get('/api/survey', ReqOptions)
      .map((res: Response) => res.json())
      .map(res => {
        this.surveyData = {
          total: res.survey.total,
          title: res.survey.title,
          id: res.survey.id,
          options: res.options
        };
        this._surveyChangeObs.next(this.surveyData);
        return res;
      });

  }
开发者ID:JSMike,项目名称:Material2-Survey,代码行数:27,代码来源:survey.svc.ts

示例4: getUsers

	//Get list of existing users
	getUsers(limit: Number): Observable<User[]>{
		
		//Setup url parameters
		let params = new URLSearchParams();
		params.set("limit", limit.toString());
		
		//Make http get request
		var request = this.http.request(new Request(new RequestOptions({
			method: RequestMethod.Get,
			url: "/api/v1/users",
			search: params
		})));
		
		//Parse json response and map to object
		return request
			.map(res => res.json())
			.map(res => {
				
				//Check response for errors
				if (res.hasOwnProperty('error')){
					alert(res.error);
					throw new Error(res.error);
				}else{
					return res.users;
				}
			})
			.map(res => res.map(u => new User(u.userId, u.username, u.email)));
	}
开发者ID:cgHome,项目名称:MEAN-AngularJS-2,代码行数:29,代码来源:users.service.ts

示例5: deleteUser

	//Delete user from backend with identifier
	deleteUser(userId: string){
		
		//Setup url parameters
		let params = new URLSearchParams();
		params.set("userId", userId);
		
		//Make http delete request
		var request = this.http.request(new Request(new RequestOptions({
			method: RequestMethod.Delete,
			url: "/api/v1/users",
			search: params
		})));
		
		//Parse json response
		return request
			.map(res => res.json())
			.map(res => {
				
				//Check response for errors
				if (res.hasOwnProperty('error')){
					throw new Error(res.error);
				}else{
					return res;
				}
			});
	}
开发者ID:cgHome,项目名称:MEAN-AngularJS-2,代码行数:27,代码来源:users.service.ts

示例6: findByUser

    /**
     *
     * @param userId
     * @returns {Observable<any[]>}
     */
    public findByUser(userId: number): Observable<Course[]>
    {
        let params = new URLSearchParams();
        params.set('user', userId.toString());

        return this.httpService.search(AppConstants.COURSES_URL + "/search/findByUser", params);
    }
开发者ID:woodforda,项目名称:vocabulary,代码行数:12,代码来源:course.repository.ts

示例7: getTTSAccessToken

 // 百度TTS 合成token
 getTTSAccessToken()
 {
   let url = "https://openapi.baidu.com/oauth/2.0/token";
   let params = {
     "grant_type": "client_credentials",
     "client_id": "TPnGgO8zxIayL9iTTctlxqny",
     "client_secret": "820591dad6912546574487991d6bcb7d"
   };
   if(this.platform.is("cordova"))
   {
     return Observable.fromPromise(this.nativeHttp.get(url, params, {})).map((res:any) =>{
       return JSON.parse(res.data);
     }).catch(this.handleError);
   }
   else
   {
     url = url.replace("https:/", "");
     let searchParams = new URLSearchParams();
     for(let key in params)
     {
       searchParams.set(key, params[key]);
     }
     let reqOpts = new RequestOptions({"search": searchParams, "headers": new Headers()});
     return this.http.get(url, reqOpts).map(res=>{
       return res.json();
     }).catch(this.handleError);
   }
 }
开发者ID:qwb0920,项目名称:ionic2-GGDream,代码行数:29,代码来源:HttpClient.ts

示例8: getCourses

    /**
     * @returns {Observable<any[]>}
     */
    getCourses(userId: number): Observable<Course[]>
    {
        let params = new URLSearchParams();
        params.set('userId', userId.toString());

        return this.httpService.search(AppConstants.COURSES_URL, params);
    }
开发者ID:woodforda,项目名称:vocabulary,代码行数:10,代码来源:course.repository.ts

示例9: getGeoEntitySuggestions

 getGeoEntitySuggestions(parentId: string, universalId: string, text: string, limit: string): Promise<Array<{ text: string, data: any }>> {
   
   let params: URLSearchParams = new URLSearchParams();
   params.set('parentId', parentId);
   params.set('universalId', universalId);    
   params.set('text', text);    
   params.set('limit', limit);    
   
   return this.http
     .get(acp + '/uploader/getGeoEntitySuggestions', {search: params})
     .toPromise()
     .then((response: any) => {
       return response.json() as Array<{ text: string, data: any }>;
     })
     .catch(this.handleError.bind(this));    
 }
开发者ID:terraframe,项目名称:geoprism,代码行数:16,代码来源:upload.service.ts

示例10: getTaxiSaftyInfosByDriverNo

    /**
     * Get the safity infomation
     * driverNo:
     */
    public getTaxiSaftyInfosByDriverNo(driverNo: string): Observable<SaftyInfoBean[]> {
        let headers = new Headers({ 'Content-Type': HEADER_CONTENT_TYPE });
        let searchs = new URLSearchParams();
        searchs.set("driverNo", driverNo);
        searchs.set("accountCode", this.commonHttpService.accountInfo.accountCode);

        let options = new RequestOptions({ headers: headers, search: searchs });

        return this.http.get(API_BASEURL + "getTaxiSaftyInfosByDriverNo", options)
            .map(res => {
                return this.commonHttpService.extractData(res);
            })
            .catch(error => {
                return this.commonHttpService.handleError(error);
            });
    }
开发者ID:qwb0920,项目名称:TaxiBus,代码行数:20,代码来源:taxi-driver-service.ts


注:本文中的@angular/http.URLSearchParams.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。