ng-focus event Directive using Angular Example

Today, We want to share with you ng-focus event Directive using Angular Example.In this post we will show you Angularjs ng-focus directive example, hear for Angularjs input field focus event? we will give you demo and example for implement.In this post, we will learn about Angularjs call function on input field focus with an example.

ng-focus event Directive using Angular Example

There are the Following The simple About AngularJS ngFocus and ngBlur directives Full Information With Example and source code.

Read Also:  ng-mouseover Event using Angular Example

As I will cover this Post with live Working example to develop Angularjs input field focus event example, so the AngularJS simple input focus on show is used for this example is following below.

AngularJS ng-focus Example

The AngularJS ng-focus directive specifies the custom behavior on focus event.

Angular is a platform for building mobile & desktop web Based user friendly and light weight applications.Angular,It’s TypeScript-based open-source Angularjs web application framework.

index.html

<!DOCTYPE html>
<html>
<head>
<title>
AngularJs ng-focus Event with Example - https://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 angularTutorialApp = angular.module('ngfocusModule', []);
angularTutorialApp.controller('ngfocusController', function ($scope) {
$scope.focusfn = function () {
	$scope.focus = true;
	$scope.ftxt='Focused'
}
$scope.blurfn = function () {
	$scope.focus = false;
	$scope.ftxt = ''
}
});
</script>
<style type="text/css">
.demoFocus
{
background-color: yellow;
}
</style>
</head>
<body>
<div ng-app="ngfocusModule" ng-controller="ngfocusController">
<h2>AngularJS ng-focus Event Example</h2>
Enter Text: <input type="text" ng-class="{ demoFocus: focus}" ng-focus="focusfn()" ng-blur="blurfn()" ng-model="ftxt">
</div>
</body>
</html>

Web Programming Tutorials Example with Demo

Read :

Read Also:  Laravel 6 Get Current User Details using Controller and blade

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about AngularJS ngFocus and ngBlur directives.
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.