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

Online AngularJS Editor

<!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.t1 +'&dt=t&q=' +$scope.textToTranslate).
then(function(response) {
$scope.greeting = response.data[0][0][0];
});
}
});

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

Text to translate: <input ng-model="textToTranslate" /><br />
<button ng-click="buttonTranslate()">translation</button>
Target Language: <select name="users" ng-model="t1">
    <option value="fr">French</option>
    <option value="de">German</option>
    <option value="ja">Japanese</option>
    <option value="es">Spanish</option>
    <option value="ru">Russian</option>
</select> <br/> <br/>
<h1>{{greeting}}</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.