javascript - Injector error - $routeParams with AngularUI router? -


went using ngroute ui.router ($stateprovider instead of $routeprovider) not sure if refactoring correctly.. trying access object detail using $routeparams id. using ui-sref id client side, not sure how render data $http.

this how getting params:

<h4 class="inline-header">topic name:</h4>    <span> <a ui-sref="listing-detail({listingid:listing._id})">{{listing.topic}}</a></span> 

from controller..

   angular   .module('identifly', [     'ui.router',     'satellizer'   ])  configroutes.$inject = ["$stateprovider", "$urlrouterprovider",  "$locationprovider"]; // minification protection function configroutes($stateprovider, $urlrouterprovider,  $locationprovider) {    $stateprovider     .state('listing-detail', {      url: '/listing/:listingid',      templateurl: 'templates/listing-show.html',      controller: 'listingshowcontroller',      controlleras: 'listingshowctrl'     }); 

hitting controller...

listingshowcontroller.$inject = ['$http', '$routeparams']; function listingshowcontroller ($http, $routeparams) {  var vm = this;    $http({     method: 'get',     url: '/api/listings/'+$routeparams.id   }).then(function successcallback(json) {     vm.listing = json.data;   }, function errorcallback(response) {     console.log('there error getting data', response);   });  }; 

and getting error: https://docs.angularjs.org/error/$injector/unpr?p0=$routeparamsprovider%20%3c-%20$routeparams%20%3c-%20listingshowcontroller


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -