<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<div ng-repeat="x in records" ng-if="$index>0">
<div> {{x}}</div>
</div>
<p>我是华丽的分割线ng-if="$index>0"</p>
<div ng-repeat="x in records" ng-if="$first">
<div> {{x}}</div>
</div>
<p>我是华丽的分割线ng-if="$first"</p>
<div ng-repeat="x in records" ng-if="!$first">
<div> {{x}}</div>
</div>
<p>我是华丽的分割线ng-if="!$first"</p>
<div ng-repeat="x in records" ng-show="notFirst($index)">
<div> {{x}}</div>
</div>
<p>我是华丽的分割线ng-show="notFirst($index)"</p>
<script>
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.notFirst = function (index) {
return index != 0;
};
$scope.records = [
"菜鸟教程1",
"菜鸟教程2",
"菜鸟教程3",
"菜鸟教程4",
]
});
</script>
</body>
</html>
效果: