2016-10-28 39 views
0

我使用ng-repeat來動態獲取我的網址,並使用ng-src通過angularjs綁定該網址。 下面的代碼ng-src沒有綁定數據

<div class="x_panel" ng-repeat="data in allreviewdata|filter:search"> 
     <div class="x_content"> 
      <div class=" review-panel"> 
       <div class="row"style="margin-bottom:30px;" > 
        <div class="col-lg-4"> 
         <span ng-bind="data.Channel"></span> 
         <span class="name_date" style="font-size:10px; font-color:#DCDCDC;" ng-bind="data.Date">date</span> 
        </div> 
        <div class="col-lg-4 pull-right"style="text-align:right;" ng-bind="data.Sentiment"> 
       </div> 
      </div> 
      <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12" style="text-align:center;"> 
      <img ng-src="data.pic_url" alt="logo" width="100px;"class="review-panel-logo"> 
      </div> 

但我無法得到正確的URL。我也曾使用{{data.pic_url}},但它給錯誤。同時其給這個錯誤

error

有誰能夠有這個解決方案?

在此先感謝您..!以這種方式

+0

IMG URL路徑不正確,我想是這樣... –

+0

@AnilKumarRam我已經給出了正確的道路。 data.channel獲得正確的值,那麼爲什麼不data.pic_url – Tarun

+0

@Tarun,你可以在單獨的選項卡中打開** data.pic_url **值? – Natiq

回答

0

使用

<img ng-src="{{data.pic_url}}"> 
+0

它給了我這個錯誤jinja2.exceptions.UndefinedError:'data'未定義 – Tarun

0

你需要有這樣的,

<div ng-controller="myCtrl"> 
     <img src="http://{{data.pic_url}}"/> 
     <img ng-src="http://{{data.pic_url}}"/> 
    </div> 

DEMO

+0

使用{{}}給我錯誤 - jinja2.exceptions.UndefinedError:'data'未定義 – Tarun