ng-keypress nicht auslösen Funktion

Ich bin neu in AngularJS. Ich bin Implementierung von ng-keypress-Ereignisse in AngularJS.
Ich bezog mich auf vielen blogs und habe versucht zu tun, wie es dargestellt ist, aber mein code funktioniert nicht!

    <div ng-app="myApp">
        <div ng-controller="MainCtrl">
            <input  ng-keypress="change($event)" type="text" >
            {{ text }}
        </div>
    </div>

Skript:

    var myApp = angular.module('myApp', []);

    myApp.controller('MainCtrl', ['$scope', function ($scope) {
        $scope.change=function($event){
            $scope.text= 'a';
        };
    }]);

Ich versuche, ändern Sie den Wert von {{text}} bei Tastendruck.. aber es funktioniert nicht!
kann mir jemand helfen!

Dank 🙂

InformationsquelleAutor bharat | 2014-07-26

Schreibe einen Kommentar