當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript AuthHttp.post方法代碼示例

本文整理匯總了TypeScript中angular2-jwt/angular2-jwt.AuthHttp.post方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AuthHttp.post方法的具體用法?TypeScript AuthHttp.post怎麽用?TypeScript AuthHttp.post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular2-jwt/angular2-jwt.AuthHttp的用法示例。


在下文中一共展示了AuthHttp.post方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: sendAuthHttpRequest

 sendAuthHttpRequest(url:string,params?:any,forceGet?:boolean) {
     if (forceGet == undefined) {
         if (params == undefined) {
             forceGet = true;
         } else {
             forceGet = false;
         }
     }
     if (params == undefined) params = forceGet?'':{};
     url = 'http://localhost:5000/api/account/' + url;
     if (forceGet) {
         if (params.length > 0) url = url + '?' + params
         return this._http.get(url)
             .map((res: Response) => res.json());
     } else {
         let body = JSON.stringify(params);
         let headers = new Headers({
             'Content-Type': 'application/json',
             'access-control-allow-origin': '*'
         });
         let options = new RequestOptions({headers: headers});
         return this._http.post(url, body, options)
             .map((res: Response) => res.json());
     }
 }
開發者ID:alkovpro,項目名稱:times,代碼行數:25,代碼來源:profile.service.ts

示例2: saveComment

    saveComment(comment:Comment) {
        let headers = new Headers();
        headers.append('Content-Type', 'application/json');

        return this.http.post('/comments.json', JSON.stringify(comment), {headers: headers})
            .map((res:Response) => res.json());

    }
開發者ID:DawidKre,項目名稱:szkolenie_mvc,代碼行數:8,代碼來源:articles.service.ts

示例3: saveCategory

    saveCategory(category:Category) {
        let headers = new Headers();
        headers.append('Content-Type', 'application/json');

        if (category.cat_id > 0) {
            return this.http.put('/categories/' + category.cat_id + '.json', JSON.stringify(category), {headers: headers})
                .map((res:Response) => res.json());
        } else {
            return this.http.post('/categories.json', JSON.stringify(category), {headers: headers})
                .map((res:Response) => res.json());
        }
    }
開發者ID:DawidKre,項目名稱:szkolenie_mvc,代碼行數:12,代碼來源:categories.service.ts

示例4: saveArticle

    saveArticle(article:Article) {
        let headers = new Headers();
        headers.append('Content-Type', 'application/json');

        if (article.art_id > 0) {
            return this.http.put('/articles/' + article.art_id + '.json', JSON.stringify(article), {headers: headers})
                .map((res:Response) => res.json());
        } else {
            return this.http.post('/articles.json', JSON.stringify(article), {headers: headers})
                .map((res:Response) => res.json());
        }
    }
開發者ID:DawidKre,項目名稱:szkolenie_mvc,代碼行數:12,代碼來源:articles.service.ts

示例5: createUser

    createUser(user:User):Observable<any>  {

        let body = {
            name: user.name,
            email: user.email,
            password: user.password
        };

        return this._http.post('/api/register',JSON.stringify(body))
            .map( res => {
                return res.json();
            })
            .catch(err => {
                let errMsg = err.message || 'Unkown error';
                return Observable.throw(errMsg);
            });

    }
開發者ID:mducnguyen,項目名稱:AccountAdmin,代碼行數:18,代碼來源:user.service.ts

示例6: saveNew

 /**
  * Add a new event to the events located at eventsURL
  * @param eventsURL
  * @param event
  * @returns {Observable<Response>}
  */
 public saveNew(eventsURL:string, event:EventRequest) {
     return this._http.post(eventsURL, JSON.stringify(event));
 }
開發者ID:mducnguyen,項目名稱:TicklrClient,代碼行數:9,代碼來源:event.service.ts

示例7: save

 save(app) {
     return this._http.post(`${baseUrl}/api/applications`, app, {headers: contentHeaders})
     .catch(this.handleException);
 }
開發者ID:marinet-web,項目名稱:marinet-app,代碼行數:4,代碼來源:apps.service.ts


注:本文中的angular2-jwt/angular2-jwt.AuthHttp.post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。