user10083387
user10083387

Reputation:

Uncaught TypeError: Cannot read property 'length' of undefined - Jasmine/Karma Angualr2

There are plenty of questions are existed regarding to this error and I have verified almost all but not getting resolved with those answers and suggestions. So please apologize for this.

I have tried to test an angular component by using Jasmine and Karma. Initially through 'ng test' I got an error like "Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/SearchActionsComponent.ngfactory.js'. thrown"

Afetr through 'ng test --source-map=false' I got error like this "Uncaught TypeError: Cannot read property 'length' of undefined". Error coming after fixture.detectChanges() as per my observation but I am not sure that exact reason. So could any one please help me.

Upvotes: 1

Views: 5268

Answers (1)

Roy
Roy

Reputation: 910

Here there is no problem with your either test case file and class file as well it seems, better to check once in template class. If any where you are handling undefined thing with respective length.

Upvotes: 2

Related Questions