I am new to AngularJS
, please help me to solve this problem.
How can I call the jQuery
function from AngularJS
.
HTML:
<div ng-controller="TestClickController">
<button ng-click="clickFunc()">Test click</button></div>
Script:
<script>
var app = angular.module('myApp', []);
app.controller('TestClickController', function($scope) {
$scope.clickFunc = function() {
$('#div1').html('User clicked');
};
});
</script>
When the button is clicked, I get the error "Error: $ is not defined"
.