2017-03-29 49 views
1

我用我的域類是這樣的:打字稿下​​劃線的大小寫轉換

export class Contact { 

    private _name: string; 
    private _phone: string; 

    get name(): string { 
    return this._name; 
    } 

    set name(value: string) { 
    this._name = value; 
    } 

    get phone(): string { 
    return this._phone; 
    } 

    set phone(value: string) { 
    this._phone = value; 
    } 

} 

我的問題是,當我發送數據通過角http.post到後端,發送的屬性是那些有下劃線和我後端僅爲camelCase準備(更改後端可能不是此處的選項)。除了在發送之前轉換JSON之外,還有其他已知選項嗎? 在此先感謝。

回答