ng-class 在 Angular 条件下无法正确呈现

ng-class not rendering properly on Angular Condition

我有一个html,如果我在输入框中输入'color',该段落必须有红色背景。我想我正在正确使用 ng-class ,但仍然无法让它变红。有人可以帮忙吗?

HTML:

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<style>
.red: {background:red}
</style>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<p ng-class="{'red':entry=='color'}"> This is box. </p>
<input ng-model="entry" />
<script>
//Module Declaration
var app = angular.module('myApp',[]);
//Controller Declaration
app.controller('myCtrl',function($scope){
    $scope.entry = "";
});
</script>
</body> 
</html>

错误在你的CSS:.red之后多了一个:

正确的声明是:

.red {background:red}