Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. directive('gMap', function(googleMaps){
  2. return{
  3. restrict: 'E',
  4. replace: true,
  5. transclude: true,
  6. template: "<div ng-transclude></div>",
  7. scope: true,
  8. link: function(scope, element, attrs){
  9. scope.$on('location', function(){
  10. //här ska den recentreras
  11. })
  12.  
  13. //create the map
  14. var center = googleMaps.makePosition(attrs.centerlat, attrs.centerlong)
  15. //update map on load
  16. var options = googleMaps.setMapOptions(center, attrs.zoom);
  17. scope.map = googleMaps.createMap(options, attrs.id)
  18. //googleMaps.addMarker(map, center,'Hello')
  19.  
  20. },
  21. controller: ['$scope', function($scope) {
  22. console.log($scope);
  23. }]
  24. };
  25. }).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement