Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script>
- <script>
- angular.module('App', []).controller('world', function ($scope) {
- $scope.value = 0;
- $scope.send = function() {
- alert($scope.value);
- }
- let readback = function() {
- $scope.value += 1;
- $scope.$apply();
- setTimeout(readback, 100);
- };
- setTimeout(readback, 1);
- });
- </script>
- </head>
- <body ng-app="App" ng-controller="world">
- <input type="text" ng-model="value" ng-keyup="$event.keyCode == 13 && send()" />
- </body>
Add Comment
Please, Sign In to add comment