How to set longitude, latitude with maker in google map?


#1

I Have list populated from sqlite

          <ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="category in branChcategories | filter:input.searchInput" type="item-text-wrap" href="#/tab/locations/"   ng-class-odd="'odd'" ng-class-even="'even'"
            <h2>&nbsp; {{category.slno}}.&nbsp;&nbsp;{{category.branch_name}}</h2>     
    		<h2>Addr.:&nbsp;{{category.branch_address}}</h2>     
    		<h2>Ph :&nbsp;{{category.phone}}</h2>
    		<h2>Fax :&nbsp;{{category.fax}}</h2>
            <i class="icon ion-chevron-right icon-accessory"></i>
  
            <ion-option-button class="button-assertive" ng-click="remove(chat)">      Delete        
            </ion-option-button>     
          </ion-item>
        </ion-list>

When i click list time , it will go to map with latitude and longitude stored in local database.I want to set longitude, latitude dynamically from local sqlite database to new google.maps.LatLng(23.730182 , 90.408583); .

Here is map controller
//Being map controller
angular.module(‘starter.directives’, [])

    .directive('map', function() {

var myCenter=new google.maps.LatLng(23.730182 , 90.408583);

      return {

        restrict: 'E',

        scope: {

          onCreate: '&'

        },
 
        link: function ($scope, $element, $attr) {

          function initialize() {

            var mapOptions = {

              center:myCenter,

              zoom:16,

              mapTypeId: google.maps.MapTypeId.ROADMAP

            };	

    		var map = new google.maps.Map($element[0],  mapOptions);
	 var marker = new google.maps.Marker({

          position: myCenter,

          map: map,

          title: 'ERA InfoTech Limited'

        });
  

            google.maps.event.addDomListener(marker,$element[0], 'mousedown', function (e) {

              e.preventDefault();

              return false;

            });

    
    		   $scope.onCreate({map: map});

    
          }
    
          if (document.readyState === "complete") {

            initialize();

          } else {

            google.maps.event.addDomListener(window, 'load', initialize);

          }

    
        }
  
      }

    });

//End map controller

I have populated list from sqlite.
longitude: res.rows.item(i).longitude,
latitude: res.rows.item(i).latitude,
are latitude and logitude value.
/Begin Show Branch Info

    			$rootScope.branChcategories = [];
  
    	  db.transaction(function(tx) {
    
                tx.executeSql("SELECT * from branch_location;", [], function(tx, res) {
    
                     var len = res.rows.length;

                     if(len>0){

                     	 for (var i = 0; i < len; i++) {
       	 //	alert("res.rows.item(0).branch_code: " + res.rows.item(i).branch_code + "Branch Name :"+res.rows.item(i).branch_name);
  
                     	 //listItems.push(res.rows.item(i).branch_code);
  
                     	  $scope.branChcategories.push({
  
                     	  	slno: res.rows.item(i).slno, 

                     	  	branch_code: res.rows.item(i).branch_code,
  
                     	  	branch_name: res.rows.item(i).branch_name,
  
                     	  	branch_address: res.rows.item(i).branch_address,
  
                     	  	 longitude: res.rows.item(i).longitude,
  
                     		 latitude: res.rows.item(i).latitude,
  
  
                     	  	phone: res.rows.item(i).phone,
  
                     		 fax: res.rows.item(i).fax
  
    
                     	  });
  
    
                     	  // Make sure to apply scope change so that ng-repeat updates

            		$scope.$apply();
    
                     	//$scope.categories.push({slno: res.rows.item(i).slno, branch_name: res.rows.item(i).branch_name});
  

                     	 }
      	 }
                     })
                });
  

            //End show branch Info

Please Help me…