Sample angular app
by ospatil
HTML
<link rel="stylesheet" href="http://angularjs.org/css/bootstrap.min.css">
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.min.js"></script>
<tag>http://google.com</tag>
JavaScript
var testapp = angular.module('testapp', [])
testapp.directive('tag', function() {
return {
restrict: 'E',
template: '<h1><a href="{{transcluded_content}}">{{transcluded_content}}</a></h1>',
replace: true,
transclude: true,
compile: function compile(tElement, tAttrs, transclude) {
return {
pre: function(scope) {
transclude(scope, function(clone) {
scope.transcluded_content = clone[0].textContent;
});
}
}
}
}
});