You could use Underscore's _.uniq
function in a computed observable, with an iterator that serializes each item to JSON for full comparison. Like this:
this.displayedCountries = ko.computed( function () {
return _.uniq( this.availableCountries(), false, ko.toJSON );
}, this );
And you could replace ko.toJSON
with a function that only returns the countryName
property of a country if that's enough to determine uniqueness (which it probably is in this case).
Updated fiddle: http://jsfiddle.net/PV7yD/2/