After initially adding a marker with a default icon, I noticed that upon updating its location, it transforms into a custom icon as desired.
map.html
<ui-gmap-google-map center="map.center"
control="map.control"
zoom="map.zoom"
options="map.options"
bounds="map.bounds"
draggable="true">
<ui-gmap-markers
models="markerArray"
coords="'self'"
icon="'icon'">
</ui-gmap-markers>
</ui-gmap-google-map>
map.js/addMarker (adds a marker with default icon)
function addMarker(markerId, latitude, longitude, icon, iconSize) {
markerIconSize = new google.maps.Size(iconSize[0],iconSize[1]);
var marker = {
id: markerId,
latitude: latitude,
longitude: longitude,
icon: {
url: icon,
scaledSize: markerIconSize
}
};
$scope.markers.push(marker);
$scope.markerArray = $scope.markers;
}
map.js/updateMarker (updates the coordinates and uses custom icon)
function updateMarker(markerId,latitude,longitude) {
var marker = _.find($scope.markerArray, function(marker) {
return marker.id = markerId;
});
marker.latitude = latitude;
marker.longitude = longitude;
}