Skip to content

Instantly share code, notes, and snippets.



Last active Dec 17, 2015
What would you like to do?
This gist is my attempt to get MapQuest to work with AngularJS templates.
// NOTE: ng-app="plunker" + AngularUI module dependency
var app = angular.module('map-app', []);
app.controller('MainCtrl', function($scope) {
$ = 'World';
<!doctype html>
<html ng-app="map-app" >
<meta charset="utf-8">
<title>AngularJS and MapQuest Plunker</title>
<link rel="stylesheet" href="">
<link href="" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<script src="//"></script>
<script src="//"></script>
<script src=""></script>
<script src="//"></script>
<script src="//"></script>
<script src=""></script>
<script src="app.js"></script>
<script src=" "></script>
<script type="text/javascript">
/*An example of using the MQA.EventUtil to hook into the window load event and execute defined function
passed in as the last parameter. You could alternatively create a plain function here and have it
executed whenever you like (e.g. <body onload="yourfunction">).*/
MQA.EventUtil.observe(window, 'load', function() {
/*Create an object for options*/
var options={
elt:document.getElementById('map'), /*ID of element on the page where you want the map added*/
zoom:13, /*initial zoom level of the map*/
latLng:{lat:40.735383, lng:-73.984655}, /*center of map in latitude/longitude */
mtype:'osm', /*map type (osm)*/
bestFitMargin:0, /*margin offset from the map viewport when applying a bestfit on shapes*/
zoomOnDoubleClick:true /*zoom in when double-clicking on map*/
/*Construct an instance of MQA.TileMap with the options object*/ = new MQA.TileMap(options);
<body ng-controller="MainCtrl">
Hello {{name}}!
<div id="map" style="width:200px; height:150px;"></div>
/* Put your css in here */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.