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:

  1. the controller has properly-defined v_style action, and
  2. 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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -