Reputation: 118
I have a controller that I'm trying to access the parameters on using $routeParams but when I check the value with console.log a reference to lodash is being made.
(function() {
'use strict';
angular
.module('card-info.controller', ['ui.bootstrap'])
.controller('CardInfoController', CardInfoController);
CardInfoController.$inject = [
'fetchCard',
'fetchSet',
'_',
'$routeParams',
'$filter',
'$location'
];
function CardInfoController (fetchCard, _, $routeParams, $filter, $location) {
var vm = this;
var id = $routeParams.id;
fetchCard.getCardInfo(id).then(function(d) {
displayCard(d);
});
...
}
)}()
Here is a link to the controller. The router event is firing and the URL is changing properly it just seems like there is something wrong within my injections.
Upvotes: 1
Views: 86
Reputation: 10849
There is a wrong offset between your injected value and the name of it
You injected fetchSet
but you did not use it in the function signature
This
function CardInfoController (fetchCard, _, $routeParams, $filter, $location) {
Should be
function CardInfoController (fetchCard, fetchSet, _, $routeParams, $filter, $location) {
And the cosmic order of the great signature is restored
Upvotes: 2
Reputation: 4876
$routeParams
is a service of the ngRoute
module, you have to add it to your module declaration:
angular
.module('card-info.controller', ['ui.bootstrap', 'ngRoute'])
.controller('CardInfoController', CardInfoController);
Source: $routeParams
Upvotes: 1