angular6 - 以下是javascript代码,我应该如何将我的angularjavascript代码转换为打字稿
问题描述
我应该如何将以下 javascript 代码转换为打字稿?
//getting state and country while changing the city
scope.getStateAndCountry = function(city) {
scope.formData.zipcode = city;
//sending request for getting state and country while changing the city
RequestSender.addressTemplateResource.get({
city: city
},
function(data) {
scope.formData.state = data.state;
scope.formData.country = data.country;
},
function(errorData) {
delete scope.formData.state;
delete scope.formData.country;
});
};
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.10/angular.min.js"></script>
解决方案
推荐阅读
- android - 如何在后台使用应用程序在 Android 上进行网络通话
- android - 错误类放置自动完成
- elasticsearch - 子“路径”失败,因为“路径”不允许为空
- postgresql - Postgis DB 结构:多年的相同表?
- html - CSS 选择器:不显示没有背景图像的空 DIV?
- swift - Swift 对数组进行排序
- c - 在 C 中将 ASCII 转换为 HEX 时跳过特殊字符
- javascript - node-schedule-tz:时区问题
- r - update() 不适用于通过 lapply() 创建的模型
- npm - 我如何在 JFrog CLI 中以非管理员用户的身份使用带有 --build-name 和 --build-number 命令选项的 npm-install?