javascript - Angularjs is not able to find my controller -
i using angular-mock inject controller unit testing. failing since keep getting following error.
[$injector:unpr] unknown provider: patientrecordscontrollerprovider <- patientrecordscontroller
here code setup -
(function () { angular.module('patient_profile', ['ngroute']); })(); (function () { var patientrecordscontroller = function () { }; angular.module('patient_profile').controller('patientrecordscontroller', patientrecordscontroller); })();
and test case
describe('patientrecordscontroller:unit-testing', function () { beforeeach(module('patient_profile')); it('timeline should array', inject(['patientrecordscontroller', function (controller) { //cant stuff } ])); });
update same procedure works fine services. how come?
controller has instantiated using $controller
service. isn't below format of test cleaner?
describe('patientrecordscontroller:unit-testing', function () { var controller; beforeeach(function(){ module('patient_profile'); inject(function(_$controller_){ controller = _$controller_('patientrecordscontroller', {}); }); }); it('timeline should array', function(){ //do stuff using controller }); });
Comments
Post a Comment