title: Create unique array based on property
body: <p>I want to create an array that does not have repeated object(all objects are unique) based on object property and if it is unique I want to push it to this array.
  Before sending it to my function I use:</p>
  
  <pre><code>vm.initResponse = angular.fromJson(response);
  </code></pre>
  
  <p>That push <code>$$hashKey</code> to each object.</p>
  
  <pre><code>    function initDropDown(list){
          console.log('initDropDown', list);
          for (var key in list) {
              //remove angularjs $$hashKey
              var obj = JSON.parse(angular.toJson(list[key]));
              //the object I want to push into new array
              var filter = {};
              filter.prop = obj.SUGNIA;
              //if indexOf returns -1 the array does not have this object
              if(vm.stockOptionsSelect.indexOf(filter) &lt; 0){
                  vm.stockOptionsSelect.push(filter);
              }
  
          }
      }
  </code></pre>
  
  <p>the list array has many objects with different <code>SUGNIA</code> and I want to create an array with all unique ones.</p>
  
  <p>I have removed <code>$$hashKey</code> has explained <a href="https://stackoverflow.com/questions/32344495/remove-hashkey-from-array">remove-hashKey</a> and using <code>indexOf</code> - <a href="https://www.w3schools.com/jsref/jsref_indexof_array.asp" rel="nofollow noreferrer">indexOf</a>.</p>
  
  <p>List data - </p>
  
  <pre><code>[
    {
      "uid": "23",
      "time": "2017-10-01 16:00:35.515",
      "SUGNIA": "stock",
      "SECURITYNAME": "IBM",
      "INDEX_IN_UI": 5
    },
    {
      "uid": "29",
      "SECURITYNUM": 629014,
      "time": "2017-09-28 16:32:26.432",
      "SUGNIA": "holdings",
      "SECURITYNAME": "FaceBook",
  
      "INDEX_IN_UI": 10
    },
    {
      "uid": "id",
      "time": "2017-09-28 16:33:20.25",
      "SUGNIA": "stock",
      "SECURITYNAME": "google",
      "INDEX_IN_UI": 0
    }
  ]
  </code></pre>
  
  <p>And my result should be :</p>
  
  <pre><code>[{"prop":"stock"}, {"prop":"holding"}]
  </code></pre>
  
  <p>But I get duplicates.</p>