Angular Remove Duplicates value From Array

Today, We want to share with you Angular Remove Duplicates value From Array.
In this post we will show you Remove Duplicates value From Array in AngularJs, hear for AngularJS – Remove duplicate objects from object array we will give you demo and example for implement.
In this post, we will learn about Removing Duplicate Entries from ng-repeat in AngularJS with an example.

Welcome to the In infinityknow.com website! You will Step By Step learn web programming, easy and very fun. This website allmost provides you with a complete web programming tutorial presented in an easy-to-follow manner. Each web programming tutorial has all the practical examples with web programming script and screenshots available.Remove Duplicates value From Array in AngularJs

here In array,The Duplicate values in any full array list sometimes makes some problems or issue so
we should check the array which could remove or delete value or obitems the duplicate values from AngularJs Array.



<title></title>
 <a href="http://yourappsfolderprogrammingname/angular.min.js">http://yourappsfolderprogrammingname/angular.min.js</a>
 
var infinityknowApp = angular.module("infinityknowApp", []);
 infinityknowApp.controller("infinityknowCtrl", function($scope) {
$scope.studentrollno = ['9898','900','900','987','575','9698','9698'];
$scope.dataResultValue = [];
 $scope.duplremoveobitems = function() {
     $scope.dataResultValue = $scope.studentrollno.filter(function(studentid, studposval) {
     return $scope.studentrollno.indexOf(studentid) == studposval;
     })
 };
});


  
	<div>  
		<div> 
		 List of Array With all Duplicate Values = {{studentrollno}}
		 simple Click button to Remove all Duplicates Array here...
		 <button>Duplicates Remove  values</button><br>
		 List of Final simple Array = {{dataResultValue}}<br>
		 
		</div> 
	</div>
  
    

Example 2 :

appfile.js

var infinityknowApp = angular.module('infinityknowApp', []);

infinityknowApp.controller('infinityknowCtrl' , function ($scope) {
    $scope.prolist = [
        { 'programmingname' : "PHP" },
        { 'programmingname' : "Angularjs" },
        { 'programmingname' : "PHP" },
        { 'programmingname' : "CSS" },
        { 'programmingname' : "HTML" },
        { 'programmingname' : "Java" },
        { 'programmingname' : "Angularjs" },
        { 'programmingname' : "HTML" },
        { 'programmingname' : "PHP" },
        { 'programmingname' : "CSS" },
		{ 'programmingname' : "Laravel" },
        { 'programmingname' : "PHP" },
        { 'programmingname' : "CSS" },
        { 'programmingname' : "HTML" },
        { 'programmingname' : "Angularjs" }
        ];
});

index.html



    <title>AngularJS Removing json Duplicates value from ng-repeat</title>
    <a href="http://yourappsfolderprogrammingname/angular.min.js">http://yourappsfolderprogrammingname/angular.min.js</a>



    <ul>
        <li>{{obitem.programmingname}}</li>
    </ul>
	<hr />
	<ul>
		<li>{{obitem.programmingname}}</li>
	<ul>
    <a href="http://appfile.js">http://appfile.js</a>



Example 3 :Simple Removing duplicates values from a JavaScript object array

var arrstudname = [
    { userfname: "a", userage: 24},
    { userfname: "b", userage: 25},
    { userfname: "abc", userage: 24},
	{ userfname: "abc", userage: 29},
	{ userfname: "add", userage: 28},
    { userfname: "b", userage: 25}
];
 
var simnewarr = [];
var newunique = {};
 
myapp.forEach(arrstudname, function(userid) {
    if (!newunique[userid.age]) {
        simnewarr.push(userid);
        newunique[userid.age] = userid;
    }
});

//uniq array display
console.log(myapp.toJson(simnewarr));

demo

http://jsfiddle.net/ThunderHemlock/bvsvzrr5/1/

READ :  AngularJs HTML DOM Manipulation With Example