2016-09-17 70 views
1
<div *ngFor="let article of articleList;let i = index"> 
        <div class="item"> 
        <div class="image-holder" 
         style="background-image: url(https://c9.io/blog/content/images/2015/07/ninja-1.jpg)"> 
         <a href="https://c9.io/blog/title-wip-cloud9-shortcutfoo/"></a> 
        </div> 
        <div class="title"> 
         <a class="title-ref" href="#">{{article.title}}</a> 
        </div> 
        <div class="text"> 
         <div> 
          {{article.description}} <a class="text-ref" href="#">>></a> 
         </div> 
        </div> 
        <div class="item-header"> 
         <div class="author"> 
          <img class="img-circle" 
           src="https://c9.io/blog/content/images/2015/05/brady.jpg" /> 
         </div> 
         <span class="author-name"><a class="user-ref" href="#">{{article.user.name}}</a></span> 
         <div class="time">2015-07-31</div> 
        </div> 
       </div> 
       </div> 

我可以看到article.title,說明等,但article.user.name是未定義的。如果{{article.user}},它會顯示對象。如何使用ngfor打印對象的屬性?

如何正確打印article.user.name

+0

什麼是「desprition」?你的意思是'描述'嗎? – halfer

回答

相關問題