Prev Demo
AngularJS
>
How To Attach A Custom Trigger To Update Model In Angularjs?
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> </head> <body> <script> var app = angular.module("app", []); app.controller("CustomTriggerController", ["$scope", function ($scope) { $scope.PD = {}; }]); </script> <div ng-app="app" ng-controller="CustomTriggerController"> <form name="myForm"> <p> Username: <input type="text" ng-model="PD.username" required ng-model-options="{updateOn : 'blur'}" /> </p> Address: <input type="text" ng-model="PD.address" required ng-model-options="{updateOn : 'default blur'}"/> </form> <hr /> <b>Username:</b> {{PD.username}} <br /> <b>Address:</b> {{PD.address}} </div> </body> </html>
Note: We DO NOT save your trial code in our database.
Output