Monday, 7 January 2019

AngularJS ng-blur directive


AngularJS ng-blur directive

ng-blur directive specifies a behaviour on blur events and use to execute the AngularJS expression or call the function that you need to manipulate the Dom or data.

Syntax:
<element ng-blur="expression">
 ...your code...
</element>

Example:

<div ng-app="myApp1" ng-controller="Employee1Controller">
<p>Url: <input ng-blur="GetInfo()" type="text" />
<
span style="color:Red"> {{ Url}}</span>
</
p>
</div>
<script>
        var myapp = angular.module('myApp1', []);
        myapp.controller('Employee1Controller', function ($scope) {
            $scope.GetInfo = function () {
                $scope.Url = "valid url accpeted as www.code-view.com.";
            }
        });
</script>

1 comment: