0

I have already added a jquery library in to my angular-cli project but i also need to add jquery form validate plugin on the top of the jquery. I also want to integrate it with my component.ts file. how can i do this.

THANK YOU FOR YOUR HELP!

1
  • you shouldn't use jQuery in angular. try using *ng-if on your div's inside your html file. Commented Aug 28, 2018 at 15:12

1 Answer 1

1

First install jQuery using npm as follows

npm install jquery — save

Include it on your cli.json file

"scripts": [ "../node_modules/jquery/dist/jquery.min.js" ]

Import

 import * from 'jquery';
    (or)
    declare var $: any;

Component

 public ngOnInit()
  {
    $(document).ready(function(){
        $("someclick").click(function(){

        });
    });
  }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.