Reputation: 43401
I'm already using test case where I use $routeParams
without a glicth but I can't make it work on this new test case.
I reduce its content to the minimal
"use strict";
angular.module('warehousesModule', ['smart-table', 'services', 'ngRoute'])
.controller('WarehouseEditCtrl', [
'$scope', '$routeParams', '$location', '$window', 'API', 'gettextCatalog', 'form',
function ($scope, $routeParams, $location, $window, API, gettextCatalog, form) {
}]);
"use strict";
describe('testModule', function () {
beforeEach(module('warehousesModule'));
describe('WarehouseEditCtrl', function () {
var $scope, ctrl, $httpBackend;
beforeEach(inject(function ($rootScope, $routeParams, $controller) {
$routeParams.compoundId = 3;
$scope = $rootScope.$new();
ctrl = $controller('WarehouseEditCtrl', {
$scope: $scope
});
}));
it('dummy', function () {
});
});
});
If I change the module and controller to another one (e.g. productsModule), it run without error.
Error: [$injector:unpr] Unknown provider: $routeParamsProvider <- $routeParams
http://errors.angularjs.org/1.3.15/$injector/unpr?p0=%24routeParamsProvider%20%3C-%20%24routeParams
at /home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1
at r (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at /home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1
at r (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at i (/home/elopez/projects/tcs_economat/frontend/static/js/vendor.min.js:1)
at workFn (/home/elopez/projects/tcs_economat/frontend/static_src/bower_components/angular-mocks/angular-mocks.js:2436)
undefined
Both modules are in my main app, do you see what's the problem here ?
Upvotes: 0
Views: 477
Reputation: 43401
I find the solution by reviewing my code with a colleague, so peer-review is the solution here !
ngRoute
dependency in my module ;angular.module('warehousesModule', ['smart-table', 'services', 'ngRoute'])
*.min.js
after adding the dependency.gulp default
Upvotes: 1