I've two arrays
$scope.shops=[{"name":"x super market","id":"1","location":"India"},{"name":"y super market","id":"2","location":"India"},{"name":"z super market","id":"3","location":"India"},{"name":"a super market","id":"4","location":"India"}]
$scope.subscribedShops=[{"name":"x super market","id":"1","location":"India"},{"name":"y super market","id":"2","location":"India"},{"name":"z super market","id":"3","location":"India"}]
i want to compare these two arrays based on the IDs and display on the html view. I want to display all the shops but with a button on the ones which are matching with $scope.subscribedShops. It's been difficult for me to handle it in ng-repeat.Please help me achieve this.
Or,In controller, It'll be helpful if i can take out the objects present in $scope.shops which are not matching with $scope.subscribedShop and put them in a different array something like this.
$scope.unsubscribedShops=[{"name":"a super market","id":"4","location":"India"}]