Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ang-google-maps

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ang-google-maps - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

src/module.development.js

6

bower.json
{
"name": "ang-google-maps",
"version": "1.0.4",
"version": "1.0.5",
"homepage": "https://github.com/khalednobani/ang-google-maps",

@@ -28,4 +28,6 @@ "description": "Initialise Google Maps, Set Location, Drop Pins, Get Connected Routes between the current location and the destination.",

"dependencies": {
"angular": "1.4.5"
"ang-google-services": "*",
"angular": "1.4.5",
"google-map": "~1.1.0"
}
}

@@ -5,49 +5,86 @@ (function(ang) {

ang.module('main', ['ang-google-maps'])
.controller('mainCtrl', ['$scope', 'Direction', mainCtrl]);
ang.module('main', ['ang-google-maps', 'ang-google-services'])
.controller('mainCtrl', ['$scope', 'Direction', '$Geocode', mainCtrl]);
function mainCtrl($scope, Direction) {
function mainCtrl($scope, Direction, $Geocode) {
console.log(Direction)
var $Self = this;
$scope.currentDestination = 'dropOff1';
$scope.test = 123123;
setModel.call($scope);
$scope.test = function($Obj) {
console.log($Obj);
$scope.handleMarkerDrop = function($Event, $Model, $AutoCompScope) {
$scope.location[$Model.name] = $Event.latLng;
$Geocode.getNames({
coords: $Event.latLng
}).then(function(results) {
$AutoCompScope.element.value = results[0].formatted_address || '';
}, function(error) {
console.error(error);
});
};
$scope.handleMarkerDrag = function($Event, $Model, $Scope) {
$scope.$watch('test', function(newValue, oldValue) {
console.log('has been changed 1');
return newValue
}).bind($scope);
//$scope.$digest();
$scope.setPickup = function($Position, $Model, $CoreModel) {
$scope.location['pickUp'] = $Position;
$scope.setLocation();
console.log("Marker Drag Event");
console.log(arguments);
};
$scope.setDropoff1 = function($Position, $Model, $CoreModel) {
$scope.location[$scope.currentDestination] = $Position;
$scope.setLocation();
};
$scope.getBindName = function(name) {
return $scope[name];
};
$scope.setLocation = function($Position, $Model, $CoreModel) {
console.log("SetLocation");
console.log(arguments);
$scope.location[$Model.name] = $Position;
console.log($scope.location);
var current = $scope.location['pick-up'],
destination = $scope.location['drop-off-1'];
var current = $scope.location['pickUp'],
destination = $scope.location[$scope.currentDestination];
if ($Model['name'] != 'drop-off-1' && $Model['name'] != 'pick-up') return;
// Show the route
if (current && destination) Direction.setRoute({
map: $scope.map,
current: current,
destination: destination
});
if (current && destination) {
Direction.setRoute({
map: $scope.map,
current: current,
destination: destination
});
}
};
window.$scope = $scope;
$scope.handleDirectionChange = function($Leg, done) {
console.log('Handle on change');
//$tempScope['pickUp'] = Math.random(1000);
$scope['pickUp'] = $Leg.start_address;
$scope[$scope.currentDestination] = $Leg.end_address;
$scope.location['pickUp'] = $Leg.start_location;
$scope.location[$scope.currentDestination] = $Leg.end_location;
// To update input fields
done($scope);
};
}

@@ -54,0 +91,0 @@

{
"name": "ang-google-maps",
"version": "1.0.4",
"version": "1.0.5",
"description": "Module to initialize Google Maps API",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,2 @@

# angular-google-maps
# ang-google-maps
Initialise Google Maps, Set Location, Drop Pins, Etc...

@@ -6,4 +6,5 @@

1. Google Directions
2. Trigger custom callback on changing directions event.
### Screenshots
![alt tag](https://raw.githubusercontent.com/khalednobani/ang-google-maps/master/assets/img/1.%20Demo.png)

@@ -9,4 +9,4 @@ (function(ang, g) {

.factory('Geocode', function() { return Geocode(); })
.factory('Direction', function() {
.factory('Direction', ['$q', function($q) {
var $DirectionService = new g.maps.DirectionsService,

@@ -16,11 +16,13 @@ $DirectionDisplay = new g.maps.DirectionsRenderer({

});
$DirectionDisplay.addListener('directions_changed', function(res) {
var $Directions = $DirectionDisplay.getDirections(),
$Map = $DirectionDisplay.getMap(),
var $Directions = this.directions,
$Map = this.map,
$Leg = $Directions.routes[0].legs[0];
$Map.locations['start_address'].value = $Leg.start_address;
$Map.locations['end_address'].value = $Leg.end_address;
if (typeof $Map.ondirectionchange == 'function') $Map.ondirectionchange($Leg, function($scope) {
if ($scope) $scope.$digest();
});

@@ -34,6 +36,6 @@ });

})
}])
.directive('mapTemp', ['$window', '$document', '$http', mapTempFactory])
.directive('autoCompleteTemp', ['$window', '$http', autoCompleteTempFactory]);
/**

@@ -43,3 +45,3 @@ * Factory of google map's marker

function MapFactory(options) {
var $Map = new g.maps.Map(

@@ -51,3 +53,3 @@ document.getElementById('main-map'),

return $Map;
}

@@ -95,3 +97,4 @@

configs: "=configs",
oncenterchange: "=oncenterchange"
oncenterchange: "=oncenterchange",
ondirectionchange: "=?ondirectionchange"
},

@@ -104,2 +107,4 @@ template: '<div class="filter" ng-transclude=""></div>',

}
mapTempFactory.$inject = ['$window', '$document', '$http'];

@@ -117,3 +122,7 @@ /**

controller: autoCompleteTempCtrl,
link: autoCompleteTempLink,
link: function($scope, element, $atts, $ctrls) {
autoCompleteTempLink.call(this, $scope, element, $atts, $ctrls);
},
scope: {

@@ -123,3 +132,3 @@ map: '=map',

onfill: '=onfill',
ondrag: '=ondrag'
ondrop: '=ondrop'
}

@@ -130,2 +139,4 @@

}
autoCompleteTempFactory.$inject = ['$window', '$http'];

@@ -150,2 +161,4 @@ /**

}
mapTempCtrl.$inject = ['$scope', 'GetPosition'];

@@ -170,2 +183,4 @@ /**

}
mapTempLink.$inject = ['$scope', 'element', 'attrs', 'ctrls'];

@@ -194,3 +209,3 @@ /**

function initMap(element) {
this.$parent.map = this.map = new g.maps.Map(this.mapContainer, this.mapOptions);

@@ -200,3 +215,5 @@

this.map.id = this.configs.id;
this.map.locations = {};
this.map.location = {};
this.map.ondirectionchange = this.ondirectionchange || undefined;
//this.map.location =

@@ -214,3 +231,3 @@ this.initMarkers = function() {

this.initMarkers();
attachMapEvents.call(this);

@@ -220,2 +237,3 @@

// For incoming features
function attachMapEvents() {

@@ -225,15 +243,2 @@

/*
this.map.addListener('bounds_changed', function($Event) {
console.log("Bounds have changed");
if(typeof self['onboundschanged'] == 'function') self.onboundschanged({
$Event: $Event,
$Map: self.map
});
});
*/
}

@@ -247,5 +252,8 @@

function autoCompleteTempCtrl($scope) {
$scope.fillInAdress = fillInAdress;
$scope.fillInAdress = fillInAdress;
$scope.model = $scope.model || {};
}
autoCompleteTempCtrl.$inject = ['$scope'];
/**

@@ -259,3 +267,3 @@ * Handles auto-complete-temp directive's link

*/
function autoCompleteTempLink($scope, element, attrs, ctrls, $rootScope) {
function autoCompleteTempLink($scope, element, attrs, ctrls) {

@@ -271,3 +279,9 @@ // Create autocomplete object

$scope.element = element[0];
$scope.$parent[$scope.model['name']] = '';
$scope.$parent.$watch($scope.model['name'], function(newValue, oldValue) {
$scope.element.value = newValue;
return newValue;
}).bind($scope.$parent);
// Attach an event into autocomplete

@@ -280,2 +294,4 @@ g.maps.event.addListener($scope.autocomplete, 'place_changed', function() {

autoCompleteTempLink.$inject = ['$scope', 'element', 'attrs', 'ctrls'];
function findInList(List, $Obj) {

@@ -299,6 +315,3 @@

var $FormedObj = {};
console.log(277);
console.log(arguments);
for (var item in $NewObj) {

@@ -314,4 +327,2 @@

console.log($FormedObj);
return $FormedObj;

@@ -324,14 +335,7 @@

var position = findInList(List || [], {key: 'name', value: model['name']});
console.log(position);
if (position != undefined) {
List[position] = extendObj(List[position], model);
} else { List.push(model); }
console.log(List);
// Push a new marker into markers list
//this.map.markers.push(this.currentMarker);
}

@@ -350,4 +354,2 @@

console.log(place);
$Self.map.setCenter($Position);

@@ -371,24 +373,16 @@

$Self.model.marker.addListener('dragend', function($Event) {
// Update current input
$Self.element.value = $Event.latLng.toString();
if(typeof $Self.ondrop == 'function') $Self.ondrop($Event, $Self.model, $Self);
console.log("Dragging is ended ...");
console.log($Event);
if(typeof $Self.ondrag == 'function') $Self.ondrag($Event, $Self.model, $Self);
});
/*
$Self.model.marker.addListener('click', function($Event) {
handleMakerClick.call($Self, $Event);
});
*/
// Push a new marker into markers list
appendMarker($Self.map.markers, $Self.model);
// Assign inputs element into map object
$Self.map.locations[$Self['model']['label']] = $Self.element;
if(typeof $Self.onfill == 'function') $Self.onfill($Position, $Self.model, place);
if(typeof $Self.onfill == 'function') $Self.onfill($Position, $Self.model, place, $Self.element);

@@ -423,3 +417,3 @@

$DirectionDisplay = configs['$DirectionDisplay'];
return {

@@ -445,4 +439,2 @@

// Display the route on the map.
console.log("OK Setting Route");
console.log(response);
$DirectionDisplay.setDirections(response);

@@ -460,13 +452,3 @@ }

}
function Geocode(configs) {
var service = new g.maps.Places.PlacesService();
//service.textSearch(
return;
}
}(angular, google));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc