0
import { Http, Headers } from '@angular/http';
export class LoginComponent implements OnInit {
let headers: Headers = new Headers();
headers.append('Content-Type','application/json');}
上面的代碼出現以下錯誤。angular2 Property'append'在類型'Headers'上不存在
'append' error: Property 'append' does not exist on type 'Headers'.
如何解決?
把你的代碼'let headers:Headers = new Headers(); headers.append('Content-Type','application/json');'在constructor'或'ngOnInit()'內。 –