2015-05-26 28 views
1

在我的流星应用 我有一个嵌套的路线流星铁路由器:加载公共资源在内部路线

this.route('assemble', { 
    path: '/assemble', 
    title: 'Assemble', 
    parent: 'home', 
    controller: 'MainLayoutController' 
    }); 

    this.route('bottypelist', { 
    path: '/assemble/bottypelist', 
    title: 'BotType - List', 
    parent: 'assemble', 
    controller: 'MainLayoutController', 
    waitOn: function(){ 
     return Meteor.subscribe('myBotTypes'); 
    } 
    });  

布局控制器加载在顶部的logobar。布局模板是

<template name="mainLayout"> 

    <div class="logobar" style="background-color:#FFF"> 
     {{> logobar}} 
    </div> 

    <div class="top"> 
     {{> yield region="header"}} 
    </div> 

    <div class=""> 
     {{> yield}} 
    </div> 

    <div class="bottom"> 
     {{> yield region="footer"}} 
    </div> 

</template> 

logobar模板有一个徽标图像。

<template name="logobar"> 

<div style="width:100%; min-width:100%; background-color:black; position:fixed; z-index:1029;"> 
    <div class="container-fluid"> 
     <div class="row" style="padding-right:0px; margin-right:0px"> 

      <div class="com-md-4"> 
       <a href="{{pathFor 'home'}}"> <img src="images/holmes_logo.png" width="280px" height="70px"></a> 
      </div> 
     </div> 
    </div> 
</div> 

</template> 

但这个图像未在应用程序中加载。 标志链接来为http://localhost:3000/assemble/images/holmes_logo.png

此链接工作正常 http://localhost:3000/images/holmes_logo.png

所以对于外部路由,图像越来越加载,但不是内部的路线。

我使用这个包面包屑monbro:铁路由器面包屑

回答

0

您需要使用绝对URL来引用你的形象:

<img src="/images/holmes_logo.png"> 

通知开头的斜杠的路径?

+0

谢谢。 !有效。 :) – kanadenipun