Angular: = instead of @
http://angularjs.org/
by gavinfoley
HTML
<div ng-controller="MyCtrl">
<su-label tooltip="field.su_documentation">{{field.su_name}}</su-label>
</div>
CSS
.tooltip-title { border: 1px solid red;}
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('suLabel', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: {
title: '=tooltip'
},
template: '<strong><a href="#" rel="tooltip" title="{{title}}" data-placement="right" ng-transclude></a></strong>',
link: function(scope, element, attrs) {
if (scope.title) {
element.addClass('tooltip-title');
}
},
}
})
function MyCtrl($scope) {
$scope.field = {
su_documentation: 'docs',
su_name: 'name'
};
}