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


TypeScript Headers.delete方法代碼示例

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


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

示例1: saveComment

 saveComment(id, comment,value){    
 var headers = new Headers();
 if (this._authenticationService.isLoggedIn()) {
     headers = this.httpClient.createHeader(headers);
     headers.append('Content-Type', 'application/json');
 }else{
     headers.delete('Authorization');
     headers.delete('Content-Type');
     headers.append('Authorization',"");
 }
 var _resultUrl = '/story/'+id+'/addRating'; 
 return this.http.post(_resultUrl, JSON.stringify({ "value": value ,"comment": comment}),{headers})
         .map(this.extractData)
         .do(data => console.log(data))
         .catch(this.handleError);
 }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:16,代碼來源:presentation.service.ts

示例2: deleteRating

 deleteRating(id){
      var headers = new Headers();
     if (this._authenticationService.isLoggedIn()) {
         headers = this.httpClient.createHeader(headers);
         headers.append('Content-Type', 'application/json');
     }else{
         headers.delete('Authorization');
         headers.delete('Content-Type');
         headers.append('Authorization',"");
     }
     var _resultUrl = '/story/'+id+'/deleteRating'; 
     return this.http.delete(_resultUrl, {headers})
             .map(this.extractData)
             .do(data => console.log(data))
             .catch(this.handleError);
 }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:16,代碼來源:presentation.service.ts

示例3: createNewStory

  createNewStory(name,author_name,co_author_name,is_published){
    var headers = new Headers();
  	if (this._authenticationService.isLoggedIn()) {
  		headers = this.httpClient.createHeader(headers);
  		headers.append('Content-Type', 'application/json');
  	}else{
  		headers.delete('Authorization');
  		headers.delete('Content-Type');
  		headers.append('Authorization',"");
  	}
	var _resultUrl = '/story/'; 
    return this.http.post(_resultUrl, JSON.stringify({ "name": name ,"authorName": author_name ,"coAuthorName": "","published":false}),{headers})
            .map(this.extractData)
            .do(data => console.log(data))
            .catch(this.handleError);
  }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:16,代碼來源:profile.service.ts

示例4: updateStoryValues

	updateStoryValues(key, value ,story_id){
	    var headers = new Headers();
	    if (this._authenticationService.isLoggedIn()) {
	  		headers = this.httpClient.createHeader(headers);
	 		headers.append('Content-Type', 'application/json');
  		}else{
  			headers.delete('Authorization');
  			headers.delete('Content-Type');
  			headers.append('Authorization',"");
  		}
		var _resultUrl = '/story/'+story_id; 
	    return this.http.put(_resultUrl, JSON.stringify(new function(){ this[key] = value; }),{headers})
	            .map(this.extractData)
	            //.do(data => console.log(data))
	            .catch(this.handleError);
	  	
	}
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:17,代碼來源:editBar.service.ts

示例5: setProfileImage

	setProfileImage(formData){
		 var headers = new Headers();
	    if (this._authenticationService.isLoggedIn()) {
	  		headers = this.httpClient.createHeader(headers);
	 	 	headers.append('Content-Type', 'multipart/form-data; boundary="myBoundary"');
  		}else{
  			headers.delete('Authorization');
  			headers.delete('Content-Type');
  			headers.append('Authorization',"");
  		}
  		
  		
		var _resultUrl = '/attachmentUI/addUserImage'; 
		console.log(_resultUrl);
	    return this.http.post(_resultUrl, formData ,{headers})
	            .map(this.extractData)
	            .do(data => console.log(data))
	            .catch(this.handleError);
	
	
	}
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:21,代碼來源:editBar.service.ts

示例6: searchUser

   searchUser (term): Observable<Search[]> {
   	var headers = new Headers();
   	if (this._authenticationService.isLoggedIn()) {
  		headers = this.httpClient.createHeader(headers);
  	}else{
  		headers.delete('Authorization');
  		headers.append('Authorization',"");
  	}
	var _resultUrl = '/user/findByName/'; // URL to JSON file
    return this.http.get(_resultUrl+term,{headers})
            .map(this.extractData)
           // .do(data => console.log(data))
            .catch(this.handleError);
  }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:14,代碼來源:search.service.ts

示例7: getLoggedInUser

	getLoggedInUser(){
		var headers = new Headers();
	    if (this._authenticationService.isLoggedIn()) {
	  		headers = this.httpClient.createHeader(headers);
  		}else{
  			headers.delete('Authorization');
  			headers.append('Authorization',"");
  		}
		var _resultUrl = '/user/'; 
	 	return this.http.get(_resultUrl+"me",{headers})
            .map(this.extractData)
           // .do(data => console.log(data))
            .catch(this.handleError);
	}
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:14,代碼來源:editBar.service.ts

示例8: saveData

	saveData(images,texts,links,actualPage){
	    var headers = new Headers();
	    if (this._authenticationService.isLoggedIn()) {
	  		headers = this.httpClient.createHeader(headers);
	 		headers.append('Content-Type', 'application/json');
  		}else{
  			headers.delete('Authorization');
  			headers.delete('Content-Type');
  			headers.append('Authorization',"");
  		}
  		
  		
  		if(texts[0]== undefined){
  			texts.splice(0, 0, {content:""});
		}
		if(texts[1] == undefined){
			texts.splice(1, 0, {content:""});
		}
  		
  		var id = actualPage['id']
		var object = {};
		object['images'] = images; 
		object['texts'] = texts; 
		object['links'] = links;
		var serializedContent =  btoa(JSON.stringify(object));
		
		
		
		//here update links!!
  		
		var _resultUrl = '/page/'+id; 
	    return this.http.put(_resultUrl, JSON.stringify({'serializedContent' : serializedContent ,'title': texts[0]['content'], 'description': texts[1]['content']}),{headers})
	            .map(this.extractData)
	            .do(data => console.log(data))
	            .catch(this.handleError);
	}
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:36,代碼來源:editBar.service.ts

示例9: addNewNode

 addNewNode(storyID,selectedID,level,position){
     var headers = new Headers();
     if (this._authenticationService.isLoggedIn()) {
         headers = this.httpClient.createHeader(headers);
         headers.append('Content-Type', 'application/json');
     } else {
         headers.delete('Authorization');
         headers.append('Authorization', "");
     }
     var _resultUrl = '/story/'+storyID+'/addPage/'+selectedID;
     return this.http.post(_resultUrl, JSON.stringify({ "title": "defaultTitle" ,"description": "defaultDescription" ,"level": level,"position":position,"serializedContent": ""}),{ headers })
         .map(this.extractData)
        // .do(data => console.log(data))
         .catch(this.handleError);  
     
 }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:16,代碼來源:nodeEditor.service.ts

示例10: getChildren

    getChildren(id){
          var headers = new Headers();
        if (this._authenticationService.isLoggedIn()) {
            headers = this.httpClient.createHeader(headers);
            headers.append('Content-Type', 'application/json');
        } else {
            headers.delete('Authorization');
            headers.append('Authorization', "");
        }

        var _resultUrl = '/page/'+id+"/getAllOutgoing/";
        return this.http.get(_resultUrl, { headers })
            .map(this.extractData)
           // .do(data => console.log(data))
            .catch(this.handleError);  
    }
開發者ID:BarbaraSikora,項目名稱:storii,代碼行數:16,代碼來源:nodeEditor.service.ts


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