Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: $$rAF.throttle is not a function error while injecting ngMock to module

There is code:

angular.module('myApp', ['ngMock']);

While loading ngMock such error appears. Uncaught TypeError: $$rAF.throttle is not a function

like image 283
Maksim Avatar asked Jul 16 '26 19:07

Maksim


1 Answers

Issue seems to be coming from angular material which decorates $$rAF service to add throttle function to it. Including angular.mocks is not enough hence. You need to mock angular material decorators too. You can probably use angular-material mock found here. It has mock for throttle. You would also need to list the module ngMaterial-mock as dependency while mocking. i.e

 angular.module('myApp', ['ngMock', 'ngMaterial-mock']);
like image 101
PSL Avatar answered Jul 18 '26 19:07

PSL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!