JSFiddle - React, Tailwind, and code Playground
by superasn
HTML
<script src="https://code.angularjs.org/1.1.0/angular.js"></script>
<div ng-app="myApp" ng-controller="mainCtrl">
<div class="content">
<h3>NG-REPEAT: Array with filter</h3>
<ul>
<li ng-repeat="item in realArray | filter:{name:2}">{{item}}</li>
</ul>
<h3>NG-REPEAT: Extended Array with filter</h3>
<ul>
<li ng-repeat="item in extendedArray | filter:{name:2}">{{item}}</li>
</ul>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('mainCtrl', ['$scope', function($scope) {
function ExtendedArray() {
Array.call(this, arguments);
this.test = function () {
return 'something';
}
}
ExtendedArray.prototype = Array.prototype;
ExtendedArray.prototype.constructor = ExtendedArray;
$scope.realArray = new Array();
$scope.realArray.push({name: 1}, {name: 2}, {name: 3});
$scope.extendedArray = new ExtendedArray();
$scope.extendedArray.push({name: 1}, {name: 2}, {name: 3});
}]);