Angular ng blur Event Example

Angular ng blur Event Example

Today, We want to share with you Angular ng blur Event Example.
In this post we will show you Angular ng blur Event Example, hear for Angular ng blur Event Example we will give you demo and example for implement.
In this post, we will learn about Angular ng blur Event Example with an example.

Simple AngularJS ng-blur Event Example

The AngularJS ng-blur events or directive specifies that HTML tag what to do if Simple HTML form element (Like input,select.) loses focus input,select,etc.. HTML tag.Angularjs ng-blur event with example

IMP NOTE : This ng-blur events or directive is only supported by the HTML FORM tags like  HTML tag list of following , 1st : <a>, 2nd is  , third is , fourth is <textarea>, and the document window object(DOM).

Basic Syntax of AngularJS ng-blur Basic Event Directive with Example

 


****Simple your code***
****Simple your code***


Element Lists : , , <textarea>,etc..

In Angularjs, ngblur directive to call Javascript function with Simple Example


<title>
AngularJs call function ng-blur Event Example : step-by-step
</title>
<img src="image/gif;" class="mce-object" width="20" height="20" alt="<script>" title="<script>" />
<img src="image/gif;" class="mce-object" width="20" height="20" alt="<script>" title="<script>" />

	

<div>

<h2>Simple AngularJs ng-blur Event function or Directive Example - step by step</h2>

			Write your text here: 

			<span style="color:#705865"><mark>{{dataresult}}</mark></span>
		</div>

	


Blur directive in AngularJS

There is no easy direct used for blur event in AngularJs.
But we can add used for blur event by Simple creating directive.

READ :  AngularJS Multiselect Dropdown List using PHP MySQLi

File : javascript

Module.directive('ng-blur', function() { //ng-blur call directive
        return { //return function
            restrict: 'A',
            link: function postLink(scope, element, attrs) { // call a function
                element.bind('blur', function () { // expression bind executes
                    scope.$apply(attrs.ngBlur); // change response
                });
            }
        };
    });

File Name : html template: index.html

	


handle controller in ng-blur event:

$scope.handleChangeInputEvent = function(){
   
   $scope.resultdata="The Specify custom behavior change on blur event data.";
}

Second way : Angularjs call simple Javascript function in ng-blur event



userm.handleChangeEvent = function(salesorder)
{
   alert(salesorder.price); //Simple new display the NEW price here : -
} 
  

Author: admin

Leave a Reply

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