The following code shows how to create Custom directive with namespace.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!-- www . j a va 2 s .co m-->
<body ng-app="app">
<g:text>Hello There</g:text>
<script type='text/javascript'>
var app = angular.module('app', []);
app.directive('gText', function() {
return {
restrict: 'E',
compile: function(tElement, attrs) {
tElement.replaceWith('<b>' + tElement.text() + '</b>');
}
}
});
</script>
</body>
</html>
The code above is rendered as follows: