ng-attr-title adds tooltip to element

Description

The following code shows how to use ng-attr-title to add tooltip to element.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
var app = angular.module('myApp', []);
function ctrl($scope){<!-- w ww  .  j av  a  2  s  .com-->
    $scope.title = "I 'm a tooltip!";
}
</script>
</head>
<body>
  <div ng-app="myApp" ng-controller="ctrl">
    <div ng-attr-title="{{title}}">Hello Buddy!</div>
</div>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities