求教大神,如何在angular只调用二维数组中指定位置的数组,比如我只用第二三条数组,

<!DOCTYPE html>
<html ng-app="myApp">
<head>

<meta charset="UTF-8">

<title>angular</title>

<script src="http://apps.bdimg.com/libs/angular.js/1.5.0-beta.0/angular.js"></script>

</head>
<body>
<div ng-controller="myCtrl">

<ul ng-repeat="x in yesterday">

    <li>价格:{{x.money}}</li>

    <li>价值:{{x.price}}</li>

    <li>评价:

        <input type="radio" name="1"/>

        {{x.ecx}}

        <input type="radio" name="1"/>

        {{x.good}}

        <input type="radio" name="1"/>

        {{x.bad}}

    </li>

</ul>

</div>
<script>
var app=angular.module('myApp',['ng']);

app.controller('myCtrl',function($scope){

    $scope.yesterday=[

        {money:"50",price:"500",ecx:"优",good:"良",bad:"差"},

        {money:"60",price:"500",ecx:"优",good:"良",bad:"差"},

        {money:"70",price:"500",ecx:"优",good:"良",bad:"差"},

        {money:"70",price:"500",ecx:"优",good:"良",bad:"差"}]

});

</script>
</body>
</html>

POPMUISE
浏览 417回答 1
1回答

倚天杖

app.filter('slice', function() {&nbsp; &nbsp; return function(input, start, end) {&nbsp; &nbsp; &nbsp; &nbsp; if(input) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return input.slice(+start, end ? +end : input.length);&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; return [];&nbsp; &nbsp; }});ng-repeat="x&nbsp;in&nbsp;yesterday&nbsp;|&nbsp;slice:&nbsp;5&nbsp;:&nbsp;7"
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript