angularjs - calling breeze from angular - service or controler - syntax please -
i have angular project. making html/angular form - getting data stored procedure via $http in service in angular. want databind of drop down lists in filter that's in html form. have data in view made models , added entity framework. how should make calls breeze in angular? code example please? in service or in controller?
------here's i've tried--------------
what doing wrong here? (may few things...i'm new angular. want able somehow call function populatestyleddl in ng-model or something....
.factory('sellingservice', ['$filter', '$http', function ($filter, $http) { function populatestyleddl() { return breeze.entityquery.fromentitynavigation('v_style') .using(context.manager).execute(); }; //check if above function legal function salesstatus(filter) { console.log(breeze); return $http({ method: 'get', url: '/services/salesstatus', params: { filter.itemstyle } }).then(function (result) { return result.data; }) } return { salesstatus: salesstatus }; }]);
--------------------------------here's have now..... ok, here i've got now. happening in js file breeze calls are. can confirm if syntax here right , how function syntaxically should in factory (and how syntax should in controller...)
function getstyles() { return breeze.entityquery .from("v_style") .using(manager) .execute(); }
@lisasolomon, regarding syntax:
function getstyles() { return breeze.entityquery .from("v_style") .using(manager) .execute(); }
looks information have. if it's not working i'd make sure:
- the controller has properly-defined v_style action, and
- the manager defined , has correct service name
so, assuming correct, need add returned object available in controller:
return { salesstatus: salesstatus, getstyles: getstyles };
then use in controller, need reference .then() of promise
$scope.styles = ''; sellingservice.getstyles().then(function(data) { $scope.styles = data.results; }).catch(function(err) { // error processing });
any error messages you're getting helpful. if there's chance show controller , view code build fiddle, great, too.
Comments
Post a Comment