Anonymous2493 Anonymous2493 - 20 days ago 5
AngularJS Question

Unknown provider error in jasmine test case

I am new to angular. I am not getting what's wrong with the following code. I have gone through this link [ http://errors.angularjs.org/1.2.26/$injector/unpr?p0=scrollToAttachmentsProvider%20%3C-%20scrollToAttachments ] and unable to find my case there

beforeEach(module('my_app'));


var initiate_controller = function(){
inject(function($controller, $rootScope) {
$scope = $rootScope.$new();
spyOn(window, 'hide_page_loader');
$controller('EntryShowController', {
$scope: $scope,
$state: $state,
entryData: entryData,
entryHistory: entryHistory
});
$scope.$digest();
});


};

Answer

As per the error , you have not defined scrollToAttachments anywhere in the code,

Add it to the controller.

 $controller('EntryShowController', {
    $scope: $scope,
    $state: $state,
    entryData: entryData,
    entryHistory: entryHistory
  });
Comments