bha*_*rat 4 keypress angularjs
我是AngularJS的新手.我正在AngularJS中实现ng-keypress事件.我提到了许多博客,并尝试按照显示的方式进行,但我的代码无效!
    <div ng-app="myApp">
        <div ng-controller="MainCtrl">
            <input  ng-keypress="change($event)" type="text" >
            {{ text }}
        </div>
    </div>
Run Code Online (Sandbox Code Playgroud)
脚本是:
    var myApp = angular.module('myApp', []);
    myApp.controller('MainCtrl', ['$scope', function ($scope) {
        $scope.change=function($event){
            $scope.text= 'a';
        };
    }]);
Run Code Online (Sandbox Code Playgroud)
我正在尝试在按键上更改{{text}}的值..但它不起作用!谁能帮我吗!
谢谢 :)
我尝试了同样的事情和它的工作
  <body ng-controller="MainCtrl">
    <input  ng-keypress="change($event)" type="text" >
    <pre>{{name}}</pre>
  </body>
app.controller('MainCtrl', function($scope) {
  $scope.name = 'World';
  $scope.change=function($event){
    $scope.name= 'hello';
    };
});
Run Code Online (Sandbox Code Playgroud)
结帐这个plunker ... PLUNKER LINK
编辑 结帐您的代码plunker ..那也工作
编辑
最后答案是:1.0.7不支持ng-keypress,因此它无法正常工作..