Angular: Using $interpolate

http://angularjs.org/

HTML

<script type="text/javascript" src="http://code.angularjs.org/0.10.6/angular-0.10.6.js"></script>

<div ng:app ng:controller="Testing">
    <input type="text" ng:model="output" />
    <a ng:test="I hope this {{output}}">test</a>
</div>

JavaScript

angular.directive('ng:test', function(expression) {
    return ['$element', '$interpolate', function(element, $interpolate) {
        var scope = this,
            parsedExp = $interpolate(expression);
        
        element.bind('click',function() {
           alert(scope.$eval(parsedExp)); 
        });
    }];
});
function Testing() {
    this.output='works';
}