Just include the link function _in_ the compile function and return it:

app.directive('draggable',function($rootScope){
        return{
            restrict: 'A',
            transclude: true,
            compile: function compile(tElement,tAttrs,transclude){
                tElement.prepend('<div><div style="width:100%; height:20px; 
background-color:#ccc; border-radius:10px;"><span id=\'cywButton\' 
class="glyphicon glyphicon-remove-circle" 
style="float:right;font-size:1.5em;cursor:pointer;margin-right:5px;" 
ng-click="hide(\'hideButton\',{\'buttonId\':\'show\'})"></span></div><div 
ng-transclude></div></div>');
                return{
                    post: function postLink(scope,element,attrs){
[link function code goes here]
                    }
                }
            }
        }

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to