2

Has anyone seen this problem and know what's going on? If you load this with chrome dev tools open you will see a 400 error ( Bad Request ) http://plnkr.co/edit/fRhBgC4SmPYL8udb007y?p=preview

The problem appears when you use an row.entity.imgurl inside the cellTemplate.

var testApp = angular.module('testApp', ['ui.grid']);

testApp.controller('TestCtrl', function($scope) {

  $scope.grid = {
    rowHeight: 50,
    data: [{
      name: 'Test',
      label: 'Suwako Moriya',
      imgurl: 'http://i.imgur.com/945LPEw.png'
    }],
    columnDefs: [
          { field: 'name'},
          { field: 'label', displayName: 'Name',
            cellTemplate: '<div class="ui-grid-cell-contents" title="TOOLTIP"><img  alt="{{COL_FIELD CUSTOM_FILTERS}}"  src="{{row.entity.imgurl}}"/>'
          }
    ]};
});
kiev
  • 2,040
  • 9
  • 32
  • 54

1 Answers1

1

You can use:

ng-src="{{row.entity.imgurl}}"
huan feng
  • 7,307
  • 2
  • 32
  • 56
  • That solved it - thank you! looked up ng-src and here is what it says...Using AngularJS markup like {{hash}} in a src attribute doesn't work right: The browser will fetch from the URL with the literal text {{hash}} until AngularJS replaces the expression inside {{hash}}. The ngSrc directive solves this problem. The buggy way to write it: Description The correct way to write it: Description https://docs.angularjs.org/api/ng/directive/ngSrc – kiev Nov 03 '17 at 15:04