Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR TypeError: _this.$ is not a function #8

Open
shaheenaakhter opened this issue May 23, 2019 · 3 comments
Open

ERROR TypeError: _this.$ is not a function #8

shaheenaakhter opened this issue May 23, 2019 · 3 comments

Comments

@shaheenaakhter
Copy link

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}

@qxl0
Copy link

qxl0 commented Sep 17, 2019

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

@ArinzeOkorji
Copy link

I am facing the same issue.

@ArinzeOkorji
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants