Add distinct items to an array in angularjs -


i'm trying add array distinct item error appears "referenceerror: $ not defined"

function unique(list) {   var result = [];   $.each(list, function(i, e) {     if ($.inarray(e, result) == -1) result.push(e);   });   return result; } 

it seems didn't load jquery.
btw implement function don't need that.

try this:

function unique(list) {     var result = [];      (var = list.length - 1; >= 0; i--) {         if (result.indexof(list[i]) == -1) {             result.push(list[i]);         }     };      return result; } 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -