AngularJs title binding

AngularJs title binding using ng-attr-title

Hello everyone, I am going to share the code sample for display the title on link mouse over using the angular title attribute(ng-attr-title).

The all the detail of title binding as given below, if you want to see the live running demo for the same then you click on below given link.





Controller code-sample as given below

    var app = angular.module('titleApp', []);
    app.controller('titleCtrl', function ($scope) {
        $scope.domain = 'http://www.code-sample.com';
    });

HTML code-sample as given below

<div ng-app="titleApp" ng-controller="titleCtrl">
   <a ng-attr-title="{{domain}}" href="#">code-sample.com</a>
</div>

The Live demo code-sample (AngularJs + HTML)

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>angularjs title binding </title>
    <script src="https://code.angularjs.org/1.3.13/angular.js"></script>
    <script>
        var app = angular.module('titleApp', []);
        app.controller('titleCtrl', function ($scope) {
            $scope.domain = 'http://www.code-sample.com';
        });
    </script>
</head>
<body ng-app="titleApp" ng-controller="titleCtrl">
    <p>AngularJs title binding</p>
    <a ng-attr-title="{{domain}}" href="http://www.code-sample.com">code-sample.com</a>
</body>
</html>


The output : go to link http://embed.plnkr.co/Bk12qs/preview



ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..
My Blogs - https://code-sample.com and https://code-sample.xyz
My Book1 - BEST SELLING ANGULAR BOOK (INCLUDING ALL VERSIONS 2, 4, 5, 6, 7)
My Book2 - ANGULAR 2 INTERVIEW QUESTIONS BOOK - Both Books are Available on WorldWide.

www.code-sample.com/. Powered by Blogger.