In this example of Ng-Focus, We will set the border of textbox to true or false on focus of textboxes and do the calculation part. See the code below:

<!DOCTYPE html> <html xmlns=""> <head> <title></title> <script src=""></script> <link rel="stylesheet" href=""> </head> <body ng-app="myApp"> <div ng-controller="myController"> <div class="container"> <label>field1:</label> <input name="focusField1" class="form-control" ng-class="{true:'border',false:''}[focusField1]" ng-model="value1" ng-focus="focusField1=true;focusField2=false" /> <label>field2:</label> <input name="focusField2" class="form-control" ng-class="{true:'border',false:''}[focusField2]" ng-model="value2" ng-focus="focusField2=true;focusField1=false" /> Focus from <b>{{focusField1==true?"Field1":"Field2"}}</b>: {{focusField1==true?value1:value2}} * {{focusField1==true?value2:value1}} = {{value1*value2}}<br /> </div> </div> <script> var app = angular.module("myApp", []); app.controller('myController', ['$scope', function ($scope) { $scope.value1 = 2; $scope.value2 = 4; }]); </script> <style> .border { border-color: skyblue !important; border-left: 5px solid red !important; } </style> </body> </html>