Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- directive('gMap', function(googleMaps){
- return{
- restrict: 'E',
- replace: true,
- transclude: true,
- template: "<div ng-transclude></div>",
- scope: true,
- link: function(scope, element, attrs){
- scope.$on('location', function(){
- //här ska den recentreras
- })
- //create the map
- var center = googleMaps.makePosition(attrs.centerlat, attrs.centerlong)
- //update map on load
- var options = googleMaps.setMapOptions(center, attrs.zoom);
- scope.map = googleMaps.createMap(options, attrs.id)
- //googleMaps.addMarker(map, center,'Hello')
- },
- controller: ['$scope', function($scope) {
- console.log($scope);
- }]
- };
- }).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement