我想在頁面加載時使用ANgularJs + TypeScript.I實現ng-options
和ng-init
方法來加載它,但我可能會遇到一些問題,這就是爲什麼我無法從我的API獲取我的數據或打電話給我的API。我已經給我的代碼提出了這個問題。Angular + TypeScript:如何獲取使用HTTP的方法Put
這裏是我的打字稿控制器: -
/// <reference path="../interface/interface.ts" />
/// <reference path="../../scripts/typings/jquery/jquery.d.ts" />
/// <reference path="../../scripts/typings/angularjs/angular.d.ts" />
module CustomerNew.controllers {
export class CreateCustomerCtrl {
static $inject = ['$scope', '$http', '$templateCache'];
debugger;
constructor(protected $scope: ICustomerScope,
protected $http: ng.IHttpService,
protected $templateCache: ng.ITemplateCacheService) {
$scope.create = this.create;
$scope.getFormData = this.getformData;
}
public getformData: (getFormData: any) => {
$http.get();
}
給錯誤AS 它給「物權或簽名預期」 &意外令牌的錯誤。 「期望構造函數,方法,訪問器或屬性」。
你有什麼錯誤?你只需要給我們所有的代碼而不需要解釋。很容易看到代碼中存在錯誤。例如:''http.get('./ Deskt ...'當你使用'[HttpPut]'時,不應該是'$ http.put'嗎?如果你想要一個好的答案解釋你的問題 –
@ Antoine Esteve我已更新我的代碼以及是它提供了「預期的屬性或簽名」錯誤和意外的令牌。「構造函數,方法,訪問器或屬性預計爲」。\t 。 –