Question

I am trying to learn Angular + Breeze (Using HotTowel.Angular and HotTowel.Angular.Breeze).

My current problem resolves around trying to hook up Breeze directly to a WCF Data Services (OData) connection (not using a BreezeController).

It seems to hook up and is calling for metadata. But since breeze.MetadataStore().FetchMetadata returns a promise, I can't wait for it to be done.

So my app keeps plowing right along. And it gets to a look up before the metadata is back and parsed.

Is there someway to tell Breeze to run fetchMetadata synchronously?
If not, then how does everyone else deal with the metadata/data race?

Was it helpful?

Solution

Just use a Q.js promise. Breeze depends on Q.js and all of the queries return a promise. Handle the then event by loading up your stuff after metadata is finished.

manager.fetchMetadata().then(function () { console.log('Finished, do something else'); });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top