I want to use `$compile` in a controller inside a function and not in a directive. is it possible? I am trying the below code. 

```
$compile('<div ng-attr-tooltip="test">Cancel</div>')(scope)

```

But this is throwing scope is undefined error. I tried to pass `$scope` inside the function but it is not working.