angular-google-maps icon indicating copy to clipboard operation
angular-google-maps copied to clipboard

[master][develop] Conditionally inject google maps script

Open ghost opened this issue 13 years ago • 15 comments

It would be nice if you could conditionally load the google maps script tag when required rather than having to have the script tag in my index.html

ghost avatar Jul 16 '13 19:07 ghost

Which branch are you referencing? Please add it to your title.

nmccready avatar Jul 17 '13 03:07 nmccready

That would apply to both branch, but since we're focusing development in r1-dev, I'll take the ball and do that when I'm freed up of my current project (couple of days now).

We also need to make the api key and sensor flags configurable. Any idea how to manage this?

nlaplante avatar Jul 19 '13 13:07 nlaplante

I am doing the API key stuff in Rails via server side injection from the config file. I guess the node project could do this. But why is this necessary to be pushed down to the directives?

Nicholas McCready

Personal Email: [email protected] Web site: http://codemonkeyseedo.blogspot.com/ Twitter: nmccready https://twitter.com/#!/nmccready

On Fri, Jul 19, 2013 at 9:17 AM, Nicolas Laplante [email protected]:

That would apply to both branch, but since we're focusing development in r1-dev, I'll take the ball and do that when I'm freed up of my current project (couple of days now).

We also need to make the api key and sensor flags configurable. Any idea how to manage this?

— Reply to this email directly or view it on GitHubhttps://github.com/nlaplante/angular-google-maps/issues/62#issuecomment-21248484 .

nmccready avatar Jul 19 '13 14:07 nmccready

To let people use the provided angular-google-maps.js without adding anything to their pages, except the angular-google-maps.js script. I once saw a directive which added the required 3rd party scripts to the page asynchronously (à la Google Analytics). We could have an angularGoogleMapsConfiguration service and its provider could let people set the api key and/or sensor flag if needed.

nlaplante avatar Jul 19 '13 14:07 nlaplante

Fist thanks for your great library. In my application, google map need only for one section. But my full system loading time depend on google-api. When internet down or slow it directly hit to the whole system.

Also page is very long, need to scroll up and down, Map position on middle of page.On the map, break page scroll up to down.(I suggest edit option to the map by using low-opacity top layer with edit button)

If it is possible to consider this kind of scenarios, it is very helpful.

sarath2 avatar Oct 22 '13 03:10 sarath2

@sarath2 @nlaplante this should probably be pushed to next release after r1-dev is switched to master

nmccready avatar Oct 22 '13 11:10 nmccready

Great news. Thanks for your amazing effort.

sarath2 avatar Oct 22 '13 17:10 sarath2

Some thinking might be done before doing this. I mean, it's the same thing with any external javascripts. I don't think we can defer the google maps script loading until a map needs to be rendered. If it's indeed possible, we have to identify side effects and/or map loading behavior before we commit to do this.

On Tue, Oct 22, 2013 at 1:10 PM, sarath2 [email protected] wrote:

Great news. Thanks for your amazing effort.

— Reply to this email directly or view it on GitHubhttps://github.com/nlaplante/angular-google-maps/issues/62#issuecomment-26822343 .

Sent from Gmail web

nlaplante avatar Oct 22 '13 18:10 nlaplante

I have a simple directive that I am using for displaying google maps in my AngularJS 1.0.7 app. It lazily injects the google maps script the first time it is needed. Here's a gist in case it helps you. https://gist.github.com/ahey/7575808

ahey avatar Nov 21 '13 03:11 ahey

Bump for this, former version could handle gracefully the injection of google maps library at runtime, the new r1-dev does not.

More importantly this generates a lot of errors with automatic test suites, as Karma/PhantomJS, at least out of the box.

Couldn't the library call google.maps only at call time instead of instantiation time? Thanks for your job :)

colthreepv avatar Dec 05 '13 11:12 colthreepv

We would have to think about this some more. A lot of logic would have to be put in to trigger all the normal events and directives initializations when the google.map get set at a later time. By all means if you have clean design in your head; create a pull request and we will think it over. WE NEED HELP and for the open source community to contribute!

nmccready avatar Dec 05 '13 14:12 nmccready

I can't agree more :) opensource needs contributors, just.. the last time i used your lib it was 200~ lines, now it is 5000 :grin: It will take me some time to get around the code, i will try to make a list of all the lines in which it gets called at instantiation time and then check if it's feasible

colthreepv avatar Dec 06 '13 08:12 colthreepv

Related to #221 , maybe a duplicate

nmccready avatar Feb 18 '14 02:02 nmccready

Keep in mind that a lot of the line numbers are from google-maps-utility-library-v3.googlecode.com portions are included.

nmccready avatar Feb 18 '14 02:02 nmccready

Closing as duplicate, please refer to #221.

cthrax avatar Aug 03 '14 15:08 cthrax