Using Angular-UI-grid version 4.4.11 with Angular 1.8, And JQuery version is 3.6.0
But the dropdown in the grid menu header just show the Code behind the tag
And the Generated HTML is as:
<button type="button" class="ui-grid-menu-item ng-binding" ng-click="itemAction($event, title)" ng-show="itemShown()" ng-class="{ 'ui-grid-menu-item-active': active(), 'ui-grid-sr-only': (!focus && screenReaderOnly) }" aria-pressed="false" tabindex="0" ng-focus="focus=true" ng-blur="focus=false">
<i ng-class="icon" aria-hidden="true" class="ui-grid-icon-sort-alt-up"> </i>function(){return e.getSafeText("sort.ascending")}
</button>
Why it's happening like this?

Here's a suggestion for you how you might make this work, which is to:
place the function call in your view and
define the function itself in your controller as shown below
(You'll want to place your view and controller in two separate files. I included everything in one file below just to display everything more clearly)