Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

CIS360 Class Assignment

<!doctype html>
<html ng-app="demo">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
<script type="text/javaScript">
    angular.module('demo', [])
    .controller('Hello', function($scope, $http) {
        
        
      $scope.buttonTranslate = function(event) {
       $http.get('https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=' + $scope.tl + '&dt=t&q=' + $scope.textToTranslate).
       then(function(response) {
          $scope.tranlation = response.data[0][0][0];
       });
      }
    });

</script>
</head>
<body>
<div ng-controller="Hello">

Text to Translate:  <input ng-model="textToTranslate" /><br /><br />
Target Language: <select name="users" ng-model="tl">
<option value="fr">French</option>
<option value="de">German</option>
<option value="ja">Japanese</option>
<option value="es">Spanish</option>
</select><br/><br/>


<button ng-click="buttonTranslate()">Translate</button>


<h1>{{tranlation}}</h1>
</div>
</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.