0
votes

Breeze will solve all my problems but I'm pretty stucked at the beginning and the doc is a lot confused, at least to me. I just wanna to know how to get data from a web service, follow some question:

What scripts that i need to include? just breeze.js or q.js and angular adapter too?

On brezze doc theres an example to retrieve "employes" like this:

manager.executeQuery(breeze.EntityQuery.from("Employees"))
       .then(function(data) { $scope.employees = data.results; });

What this ".from("Employees")" does? I'm dealing with web service this "Employees" should'nt be an URL?

2
Maybe you should consider Restangular, it integrates well with angular and the doc is great github.com/mgonto/restangular - kfis
restangular deal with localstorage too? - Daniel Faria

2 Answers

0
votes

They loaded

 <script src="/Scripts/jquery-1.8.2.js"> 
 <script src="/Scripts/angular.js"> 
 <script src="/Scripts/q.js"> 
 <script src="/Scripts/breeze.debug.js">

I think that

    var manager = new breeze.EntityManager('api/northwind'); 

initialises the base url.

so

  var query = new breeze.EntityQuery().from("Employees");
  manager.executeQuery(query)

ends up in a request to GET api/northwind/Employees

0
votes

For your question if Q.js is needed: By default, Breeze asynchronous methods return Q.js promises not AngularJS $q promises. You have to include the Q.js library in your client stack.

You can switch to Angular's $q promises by including "breeze.angular.q.js" in your application and telling Breeze which $q instance to use. Then you can remove the Q.js library from your application.

Check more here http://www.breezejs.com/breeze-labs/breezeangularqjs .