M. Brandel
M. Brandel

Reputation: 55

uib-popover-template with dynamic url

I am trying to use a uib-popover-template in a grid and supply an Id in the url. Can I create the url dynamically? Something like:

uib-popover-template="../assets/asset-bulk-upload/edit-bulk-asset/{{asset.AssetId}}"

This does not seem to work. If I "hard code" it on my angular scope it works fine.

<a href="" title="" class="btn btn-primary"
    ng-if="asset.Error"
    uib-popover-template="../assets/asset-bulk-upload/edit-bulk-asset/{{asset.AssetId}}"
    popover-title="{{asset.AssetCode}}"
    popover-trigger="outsideClick"
    popover-placement="auto left"
    tabindex="2"
    ng-click="openPopover();">@Model.FixErrorsLabel</a>

This does work (but Id is static):

   $scope.dynamicPopover = {
     assetEditBulkTemplateUrl: '../assets/asset-bulk-upload/edit-bulk-asset/5'
   };

Upvotes: 3

Views: 1521

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136184

uib-popover-template takes an expression, and it evaluates it against underlying scope variable. You should rather provide string with and the remaining part can be easily concatenated

uib-popover-template="'../assets/asset-bulk-upload/edit-bulk-asset/'+asset.AssetId"

Upvotes: 2

Related Questions