Pass value through directive argument

Add attribute inside element and bind text using directive

by Jscaptcha

HTML

<script src="https://code.angularjs.org/angular-1.0.0rc5.min.js"></script>
<html ng-app="HelloApp">
    <body>
         <span bind-elementtext></span>
        <div pass-argumenttext welcome-msg = 'this is value for argument' ></div>
    </body>
</html>

JavaScript

angular.module('directiveDemo', [])
.directive('bindElementtext', function () {
    return function (scope, element, attr)
    {
        element.text('Hello text is binded through directive function');
    }
  })
.directive('passArgumenttext',function(){
	 return function(scope,element,attr)
     {
         alert('Passed argument value is : '+attr.welcomeMsg )
     }
})

angular.module('HelloApp', ['directiveDemo'] )