Bind element text using directive
bind text inside span /div
by Jscaptcha
HTML
<script src="https://code.angularjs.org/angular-1.0.0rc5.min.js"></script>
<html ng-app="HelloApp">
<body>
<hello-world name="John Lindquist"></hello-world> <span bind-elementtext> </span>
</body>
</html>
JavaScript
angular.module('directiveDemo', [])
.directive('bindElementtext', function () {
return function (scope, element, attr) {
element.text('Hello text is binded through directive function');
};
})
angular.module('HelloApp', ['directiveDemo'])