javascript - How do I add rotation angle to the marker using ng-app? -


i not able add angle rotation marker. want calculate angle between current latitude longitude , next latitude longitude , accordingly place car icon. tried adding rotation @ place declaring car , bike icons did not help.

html file:

    <div class="row" ng-controller="admin">       <div class="col-xs-12 col-md-12">         <ng-map center="pune india" zoom="13">          <marker ng-repeat="v in selectedvehicles" icon="{{showicon(v)}}"             position="{{markers[v.id]}}" on-click="showdetails(event, v)">             </marker>      </ng-map>     </div> 

javascript file:

var app = angular.module('tripnship'); app.controller('admin', ['$scope','ngmap','vehicle',     function($scope,ngmap,vehicle) {     $scope.vehicles = vehicle.all();   $scope.selectedvehicles = [];     var car_icon = {     scaledsize: [60, 30],     url: '<%= asset_path("car.svg") %>'   };    var bike_icon = {     scaledsize: [60, 30],     url: '<%= asset_path("bike.svg") %>'   };    $scope.showicon = function(vehicle) {     if (vehicle.v_type == "bike"){       return bike_icon;     } else {       return car_icon;     }   };    $scope.showvehicles = function(vehs){     $scope.markers = {};     $scope.selectedvehicles = vehs;     var vehicles = vehs.map(function(v) {return v.id;});     vehicles.foreach(function(id) {       var source = new eventsource('/api/v1/vehicle_locations?vehicle_id=' + id);       source.onmessage = function(event) {         $scope.$apply(function () {           var data = json.parse(event.data);           if(vehicles.indexof(data.vehicle_id) !== -1) {             $scope.markers[id] = [data.lat, data.lon];           }else{             source.close();           }         });       };     });    };    $scope.showdetails = function(event, vehicle) {     $scope.selectedvehicle = vehicle;     $scope.map.showinfowindow('myinfowindow', this);   }; }]); 


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -