angular-fundamentals-files icon indicating copy to clipboard operation
angular-fundamentals-files copied to clipboard

ERROR TypeError: _this.$ is not a function

Open shaheenaakhter opened this issue 5 years ago • 3 comments

Hi there,

I'm creating ModalTriggerDirective ,have followed each and every bit of the course.When trying to open dialog box on click of search button.I get this error.Please help :(.

ModalTriggerDirective

Have created JQ_TOKEN and imported the service in the directive. app.module.ts let jQuery: any; {provide: JQ_TOKEN, useValue: jQuery}

shaheenaakhter avatar May 23 '19 04:05 shaheenaakhter

I got into the exact error. It's not easy to fix.

qxl0 avatar Sep 17 '19 13:09 qxl0

I am facing the same issue.

ArinzeOkorji avatar Mar 18 '20 18:03 ArinzeOkorji

In the directive file, add

import $ from 'jquery' ; declare var $:$;

Remove/comment out the token injection in the constructor

use $ instead of this.$ in the addEventListener function.

Worked for me.

ArinzeOkorji avatar Mar 18 '20 20:03 ArinzeOkorji