Skip to content

Instantly share code, notes, and snippets.

@alexjamesbrown
Created February 20, 2014 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexjamesbrown/9118022 to your computer and use it in GitHub Desktop.
Save alexjamesbrown/9118022 to your computer and use it in GitHub Desktop.
Using GeoComplete with RequireJS
<!DOCTYPE html>
<html>
<head>
<title>RequireJS Async plugin</title>
</head>
<body>
<h1>Geocomplete With RequireJS</h1>
<form>
<input id="geocomplete" type="text" placeholder="Type in an address" size="90" autocomplete="off">
<input id="find" type="button" value="find">
</form>
<div id="map_canvas" style="width: 400px; height: 300px; border: 1px solid #ccc; background-color: #f5f5f5"></div>
<script src="./lib/require.js"></script>
<script>
requirejs.config({
waitSeconds: 120,
paths: {
async: './lib/async',
jquery: './lib/jquery-1.7.2.min',
geocomplete: './lib/jquery.geocomplete.min'
},
shim: {
'geocomplete': ['jquery'],
}
});
require(['async!http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false', 'jquery', 'geocomplete'], function () {
$("#geocomplete").geocomplete({
map: "#map_canvas"
});
}
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment