angularjs - Angular UI-Router not passing params to service call -


first, in advance. i'm noob angular though did search quite bit trying resolve issue. i'm guessing missed obvious. i'm using ui-router , using resolve property call resource , can't life of me pass params web service.

first, routes , states:

(function () {     "use strict";     var app = angular.module("mymodule",         ["ui.router",          "ngresource",          "common.services"]);     app.config(["$stateprovider", '$urlrouterprovider',         function ($stateprovider, $urlrouterprovider) {             $urlrouterprovider.otherwise("/");              $stateprovider.state("home", {                 url: "/",                 templateurl: "welcomeview.html"             })             $stateprovider.state("vehiclelist", {                 url: "/vehicles",                 templateurl: "app/vehicles/vehiclelistview.html",                 controller: "vehiclelistcontroller vm"             })             $stateprovider.state("vehicleedit", {                 url: "/vehicles/edit/:vin",                 templateurl: "app/vehicles/vehicleeditview.html",                 controller: "vehicleeditcontroller vm",                 resolve: {                     vehicleresource: "vehicleresource",                     vehicle: function (vehicleresource, $stateparams) {                         var vehiclevin = $stateparams.vin;                         return vehicleresource.get(                             { vin: $stateparams.vin }).$promise;                      }                 }             })             $stateprovider.state("vehicledetails", {                 url: "/vehicles/:vin",                 templateurl: "app/vehicles/vehicledetailsview.html",                 controller: "vehicledetailscontroller vm",                 resolve: {                     vehicleresource: "vehicleresource",                     vehicle: function (vehicleresource, $stateparams) {                         var vehiclevin = $stateparams.vin;                         return vehicleresource.get(                             { vin: 't123432342' }).$promise;                      }                 }             })         }     ]); }()); 

note see couple of varieties of passing vin i've tried numerous ways passing in variable vehiclevin, string, etc. vehiclevin variable assign there injecting $stateparams or passing vin doesn't seem problem.

here resource:

(function () {     "use strict";      angular         .module("common.services")         .factory("vehicleresource",             ["$resource",              "appsettings",             vehicleresource]);      function vehicleresource($resource, appsettings) {         return $resource(appsettings.serverpath + "/api/vehicle/:vin", { vin: '@vin' },             {                 'update': { method: 'put' },                 'details': { method: 'get' },                 'query': { method: 'get', isarray = true }             });     } }()); 

here common.services:

(function () {     "use strict";      angular         .module("common.services", ["ngresource"])         .constant("appsettings",         {             serverpath: "http://localhost:8098"         }); }()); 

and here service end of (asp.net webapi):

// api/vehicle [enablequery(allowedqueryoptions = allowedqueryoptions.all, allowedorderbyproperties = "name")] [responsetype(typeof(iqueryable<ienumerable<ivehicle>>))] public ihttpactionresult get() {     return listofvehicles...blah..blah }  // api/vehicle/5 [responsetype(typeof(iqueryable<ivehicle>))] public ihttpactionresult get(string vin) {     return singlevehicle...blah...blah } 

every time execute it, breakpoint hits (without vin parameter) , when run fiddler, looks it's sending empty body.

any ideas on going on? appreciated!


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -