how to call function in angularjs?

Today, We want to share with you how to call function in angularjs?.In this post we will show you Angularjs raise function in ng-click event with example, hear for calling function into another function with in the same Controller Angular Js we will give you demo and example for implement.In this post, we will learn about Angularjs Ng-Keypress Event Handling Directive with an example.

Read Also:  Module Controller using Angular Example

AngularJS Call Function in ng-click Event Example

Example 1: index.html

<!DOCTYPE html>
<html>
<head>
<title>
AngularJs calling Function in ng-click Event Example - www.pakainfo.com
</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script type="text/javascript">
var app = angular.module('ngclickApp', []);
app.controller('ngclickCtrl', function ($scope) {
$scope.totoalFlag = 0;
$scope.getdetails = function () {
$scope.totoalFlag = $scope.totoalFlag + 1;
}
});
</script>
</head>
<body>
<div ng-app="ngclickApp" ng-controller="ngclickCtrl">
<h2>AngularJs calling Function in ng-click Event Example - - www.pakainfo.com</h2>
<input type="button" style="cursor:pointer" value="Click Here" ng-click ="getdetails()" /><br /><br />
<span style="color:Red">Number of Times you Clicked: {{totoalFlag}}</span>
</div>
</body>
</html>

I hope you get an idea about AngularJS function scope Example with demo.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  Multiple Controllers on Page using Angular Example

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *