Jquery Scripts In Angularjs Project
I am working on angularjs project that I generated using yeoman angular generator. I have a jQuery function that I need to use in most of my html views. A possible solution is to
Solution 1:
DOM manipulation is done with directives in angularjs you will need to check out the docs: https://docs.angularjs.org/guide/directive
If you are not manipulating the DOM you can create a service that can be injected into any controller. Services documentation: https://docs.angularjs.org/guide/services
from there you can assign a function in the controller to the scope that can be accessed in the view. e.g.
$scope.MyFunction = function(){
// Code goes here
}
you can call the function in the html as
<divng-click="MyFunction()"></div>
Post a Comment for "Jquery Scripts In Angularjs Project"