Great!  Glad that got you going.  Timing is one of the bigger challenges
with angular I have found.  For example, I have my app set up such that
initial data is loaded in app.run and once all xhr calls are complete, it
then sets a ready variable on $rootScope. Each controller $watches this
variable such that no matter what URL a user comes in to the app on,
certain routines don't fire until that ready variable is set.  It only has
to be set that one time for the life of the app (until a refresh).



On Fri, Sep 12, 2014 at 9:03 AM, Dan Martin <[email protected]> wrote:

> Luke, thanks to your suggestion, I was able to get passed this.
>
> I broadcast an event that gets fired when the app becomes ready/available
> from within app.run (as you suggested).  Then, I have a DB service that
> reacts on the event, retrieving the CBL URL (via CBL plugin) and saves it
> in memory (variable) for future DB requests (via REST) from my factories.
>
>
> On Thursday, August 28, 2014 2:06:03 AM UTC-4, Luke Kende wrote:
>>
>> $watch in app.run and broadcast event to controllers, you'll need some
>> loading screen.  It's timing, you control that by not letting things
>> execute until they are ready.  You can also wait until the value is present
>> before bootstrapping angular if you prefer.
>>
>> On Wednesday, August 27, 2014 1:01:33 PM UTC-6, Dan Martin wrote:
>>>
>>> I'm working on a hybrid (Ionic <http://ionicframework.com/> -
>>> AngularJS-based mobile framework) mobile application that has an embedded
>>> NoSQL datastore, Couchbase Lite <http://www.couchbase.com/mobile>.  CBL
>>> plug-in for PhoneGap/Cordova/Ionic only provides a method for retrieving
>>> the URL of the embedded DB.  And it seems like it's only accessible "on
>>> device ready" (I tried calling the function else where and didn't work).
>>>
>>> I was hoping to resolve the URL during Angular's bootstrap phase and
>>> save it to the rootScope so it's accessible elsewhere in the application,
>>> particularly in my services, but this didn't work either.
>>>
>>> I'm kind of stuck because there is no other way for me to provide a URL
>>> for my resources.
>>>
>>>
>>> Thoughts...solutions??
>>>
>>>
>>> Thanks,
>>> Dan
>>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/1_XmE63Yq30/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to