Skip to content

Instantly share code, notes, and snippets.

@toamitkumar
Last active August 29, 2015 14:16
Show Gist options
  • Save toamitkumar/7e138e85d53bab9014d2 to your computer and use it in GitHub Desktop.
Save toamitkumar/7e138e85d53bab9014d2 to your computer and use it in GitHub Desktop.

Revisions

  1. toamitkumar revised this gist Feb 24, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions angular lazy load modules
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,8 @@ angular.module('xyzApp', [
    });
    }]);


    // Routes
    var routes = {
    '/': {
    templateUrl: 'views/home.html',
  2. toamitkumar revised this gist Feb 24, 2015. 1 changed file with 35 additions and 1 deletion.
    36 changes: 35 additions & 1 deletion angular lazy load modules
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,38 @@ angular.module('xyzApp', [
    client: 'gme-xyz',
    v: '3.17'
    });
    }]);
    }]);

    var routes = {
    '/': {
    templateUrl: 'views/home.html',
    controller: 'MainCtrl'
    },
    '/google-map': {
    templateUrl: 'views/google-map.html',
    controller: 'GoogleCntrl',
    resolve: {
    lazyGmaps: ['$q', '$ocLazyLoad', '$window', 'Features',
    function($q, $ocLazyLoad, $window, Features) {
    if (typeof google !== 'undefined' && angular.isDefined(google.maps)) return false;
    var deferred = $q.defer();
    $window.onGoogleMapsReadySearchresultsCtrl = function() {
    delete($window.onGoogleMapsReadySearchresultsCtrl);
    deferred.resolve();
    };
    $ocLazyLoad
    .load('https://maps.googleapis.com/maps/api/js?client=gme-thomascookukgroup&v=3.17&callback=onGoogleMapsReadySearchresultsCtrl')
    .catch(function() {
    if (!angular.isDefined($window.onGoogleMapsReadySearchresultsCtrl)) return;
    $window.onGoogleMapsReadySearchresultsCtrl();
    });
    return deferred.promise;
    }
    }]
    }
    }
    };

    Object.keys(routes).forEach(function (route){
    $routeProvider.when(route, routes[route]);
    });
  3. toamitkumar revised this gist Feb 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion angular lazy load modules
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ angular.module('xyzApp', [
    ])
    .config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider) {
    uiGmapGoogleMapApiProvider.configure({
    client: 'gme-thomascookukgroup',
    client: 'gme-xyz',
    v: '3.17'
    });
    }]);
  4. toamitkumar created this gist Feb 24, 2015.
    15 changes: 15 additions & 0 deletions angular lazy load modules
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    angular.module('xyzApp', [
    '....'
    'uiGmapgoogle-maps',
    'ui.bootstrap',
    'duScroll',
    'base64',
    'angularModalService',
    'oc.lazyLoad'
    ])
    .config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider) {
    uiGmapGoogleMapApiProvider.configure({
    client: 'gme-thomascookukgroup',
    v: '3.17'
    });
    }]);