首页 > 解决方案 > 以下是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>

标签: angular6

解决方案


推荐阅读