Binding In Directive
For my bro Omar... Bromar
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div my-component>Replace Me</div>
JavaScript
var module = angular.module('DirectiveBinding', []);
module.directive("myComponent", function() {
return {
restrict: "A",
replace: true,
template: "<div ng-click='clicked()'><a class='btn btn-primary' title='{{toolTip}}'>Click Me</a></div>",
controller: function($scope) {
$scope.toolTip = "hello";
$scope.clicked = function() {
$scope.toolTip = "hello world";
};
}
};
});