Giter Site home page Giter Site logo

sanchitagrawal89 / angularjs-google-directions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dbaq/angularjs-google-directions

0.0 2.0 0.0 164 KB

An angular.js wrapper around the Google Directions API

License: MIT License

JavaScript 100.00%

angularjs-google-directions's Introduction

AngularJS-Google-Directions

An angular.js wrapper around the Google Directions API (heavily inspired by AngularJS-Google-Places)

Bower

This module is available as bower package, install it with this command:

bower install angularjs-google-directions

or

bower install git://github.com/dbaq/angularjs-google-directions.git

Demo

See this plunker

Usage

  • Include the Google Maps JS library in your app
  • Add dbaq.google.directions as a dependency
  • Inject googleDirections as a dependency to your controller or other service
  • Invoke the getDirections method and pass in an origin and a destination

Example

var myApp = angular.module('myApp', ['dbaq.google.directions']);

myApp.controller('mainCtrl', function($scope, googleDirections) {
  var args = {
    origin: '37.7738571,-122.4102823',
    destination: '37.7891231,-122.4173545',
    travelMode: 'bicycling'
  }

  $scope.directions = googleDirections.getDirections(args).then(function(directions) {
    return directions;
  });
});

Further Customizations

You can override any default option below by passing that property to the getDirections method

var defaults = {
    unitSystem: null,
    durationInTraffic: false,
    waypoints: [],
    optimizeWaypoints: false,
    provideRouteAlternatives: false,
    avoidHighways: false,
    avoidTolls: false,
    travelMode: 'driving', // bicycling, transit, walking
    unitSystem: 'metric', // imperial
};

Testing

TODO

License

MIT

angularjs-google-directions's People

Contributors

dbaq avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.