【发布时间】:2015-04-13 08:26:48
【问题描述】:
我正在使用 Angular 和 typescript 来访问 REST Web 服务。我对打字稿很陌生,所以我的问题可能很基本,或者我的方法是错误的。当 grunt 编译我的 exampleController.ts 时,我不断收到错误 TS1005: ';' expected。
我已经搜索了解决方案,但没有找到任何对我有帮助的东西。我已经在使用import angular = require('angular');
我的控制器代码看起来像这样:
class ExampleComponentController {
public static $inject = [
'$scope',
'productRestService',
'$http'
];
$scope.submit = function(form) {
var config = {
'username' : $scope.name,
'password' : $scope.pass
};
var $promise = $http.post('requat_url', config)
.success(function(data, status, headers, config) {
...
})
.error(function(data, status, headers, config) {
...
});
};
constructor(...) {...}
}
错误出现在$scope.submit 所在的行。任何建议都会被采纳。
【问题讨论】:
标签: angularjs gruntjs typescript