我正在学习一个基于1.2版的AngularJS教程,我发现它在最新的1.7.2版上不起作用。
经过几次测试,我意识到它在1.3+版本上不起作用,但是根据文档,在
ng-controller
使用。
我的代码是:
<div id="example" ng-controller="CommentsCtrl">
<div ng-repeat="comment in comments | filter:{content: query} | orderBy: order">
<p>
<strong>{{comment.username}}</strong><br/>
{{comment.content}}
</p>
</div>
</div>
<script>
function CommentsCtrl($scope) {
$scope.comments=[
{
"username": "Geraldine",
"city": "Dola",
"email": "geraldinemaddox@enervate.com",
"content": "Dolor consectetur..."
},
...
]
}
</script>
为了让您更好地了解问题,代码如下:
jsfiddle
请问怎么了?