Do you have a reason for using execCommand()? execCommand expects the HTML you pass to be a string, which will prevent you from getting the benefit of Angulars data-binding. That is, if you change the url-property on the scope, the DOM won't get updated.
I'd implement it like this instead:
angular.module('app', [])
.directive('edit', function($compile){
return {
link: function(scope, elm, attr){
scope.url = "http://www.google.com";
scope.press = function(){
var link = $compile('<a ng-href="{{url}}">test</a>')(scope);
elm.append(link);
};
}
};
});