The best way to remove duplicate strings in an array

We have managed to create the script below to remove any duplicate strings from an array however it is important that we keep the order of the array for when angular loops through them on an ng-repeat.