Advertisement
Varun_Krishna

TypeError: Cannot read property '*' of undefined

Jan 28th, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TypeError: Cannot read property '*' of undefined
  2. //mycontroller.js
  3. angular.module('mymodule' []{
  4. .controller('ctrl',['dep1', 'dep2', 'depn']function(dep1, dep2, depn)
  5. $scope.list = {
  6. fname : routeParam.fname,
  7. lname : routeParam.lname,
  8. },
  9. .....
  10. })
  11. //mycontroller-spec.js
  12. describe('test suite", function (){)
  13. beforeEach('mymodule'));
  14. beforeEach(inject(function($controller, $rootScope) {
  15.            scope = $rootScope.$new();
  16.             ctrl = $controller('ctrl', {               
  17.                $scope: scope,
  18. .......
  19. ......
  20. it('should  return test scope', function() {
  21.         //expect(scope.list.fname).toEqual('');
  22.         expect(scope.list.fname).toBe(undefined);
  23.         //expect(scope.list.lname).toBe(undefined);
  24.  
  25. });
  26. But if i run this test spec I am getting the following error
  27. "TypeError: Cannot read property 'fname' of undefined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement