<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<style>
body {
padding-top:30px;
}
</style>
<script src="angular.js"></script>
<script>
var app = angular.module('app', []);
app.controller('Ctrl', function ($scope) {
//array of edited fields (optional)
$scope.focusField1 = false;
$scope.focusField2 = false;
//handle method for field1 blur
$scope.doneEditing1 = function () {
$scope.countedValue = 'Blur from field1: ' + $scope.value1 + ' * ' + $scope.value2 + ' = ' + $scope.value1 * $scope.value2;
}
//handle method for field2 blur
$scope.doneEditing2 = function () {
$scope.countedValue = 'Blur from field2: ' + $scope.value2 + ' * ' + $scope.value1 + ' = ' + $scope.value1 * $scope.value2;
}
$scope.value1 = 1;
$scope.value2 = 2;
$scope.countedValue = 'After blur on field change to field1 * field2';
});
//focus directive
app.directive('myFocus', function () {
return {
restrict: 'A',
<html>
<head>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<style>
body {
padding-top:30px;
}
</style>
<script src="angular.js"></script>
<script>
var app = angular.module('app', []);
app.controller('Ctrl', function ($scope) {
//array of edited fields (optional)
$scope.focusField1 = false;
$scope.focusField2 = false;
//handle method for field1 blur
$scope.doneEditing1 = function () {
$scope.countedValue = 'Blur from field1: ' + $scope.value1 + ' * ' + $scope.value2 + ' = ' + $scope.value1 * $scope.value2;
}
//handle method for field2 blur
$scope.doneEditing2 = function () {
$scope.countedValue = 'Blur from field2: ' + $scope.value2 + ' * ' + $scope.value1 + ' = ' + $scope.value1 * $scope.value2;
}
$scope.value1 = 1;
$scope.value2 = 2;
$scope.countedValue = 'After blur on field change to field1 * field2';
});
//focus directive
app.directive('myFocus', function () {
return {
restrict: 'A',