JSFiddle - React, Tailwind, and code Playground

by saidulu401

HTML

<div ng-app="MY_APP">
  <div ng-controller="MyCtrl"> test
     <ul ng-repeat="subitem in items | unique:'author'">
     <li>{{ subitem.author }} </li>
</ul>
</div>
</div>

JavaScript

var app = angular.module("MY_APP", []);

app.controller("MyCtrl", function($scope) {
  
  $scope.items = [{
    author:'sai',
    title:'developer',
    'date':'14-04-2017'
  },
  {
    author:'sai',
    title:'developer',
    'date':'14-04-2017'
  },
  {
    author:'sai1',
    title:'developer',
    'date':'14-04-2017'
  },
  {
    author:'sai1',
    title:'developer',
    'date':'14-04-2017'
  }];
  
});

app.filter('unique', function() {
        return function(collection, primaryKey) {
          var output = [], 
              keys = [];

          angular.forEach(collection, function(item) {
                var key= item[primaryKey] 

                if(keys.indexOf(key) === -1) {
                  keys.push(key);
                  output.push(item);
                }
          });

          return output;
        };
    });