<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script src="angular.min.js"></script>
<script>
var myApp = angular.module("myApp", []);
myApp.controller("testCtrl", function($scope){
$scope.myClass = 'red';
$scope.isClick = 'No!';
$scope.myKeyup = function(e){
var keycode = window.event?e.keyCode:e.which;
if(keycode==13){
$scope.myClass = 'green';
$scope.myClick();
}
};
$scope.myClick = function(){
$scope.isClick = 'Yes!';
};
});
</script>
<style>
.red {color:red}
.green {color:green}
</style>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="testCtrl">
<input ng-keyup="myKeyup($event)" type="text" />
<ul>
<li ng-click="myClick()" class="{{myClass}}">{{isClick}}</li>
</ul>
</div>
</div>
</body>
</html>