<h1>Example: ngFocus / ngBlur</h1>
<p>ngFocusはFocusイベント、ngBlurはBlurイベントをリスナー登録します。</p>
<div ng-app="myApp">
  <div ng-controller="myController">
    <input type="text" ng-focus="focus()" ng-blur="blur()" ng-model="focusText">
  </div>
</div>
@import "bourbon";

body {
  padding: 1.5rem;
}
View Compiled
var app = angular.module('myApp', []);

app.controller('myController', ['$scope', function($scope){
  $scope.focusText;
  
  $scope.focus = function(){
    $scope.focusText = 'Focus Text';
  }
  
  $scope.blur = function(){
    $scope.focusText = '';
  }
}]);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js