2016-04-23 59 views
0

我使用去琅与角度打造这种做法车视图没有发现我的形象根: 这是我main.go为什么

router.GET("/shopping", carBaseController.CarsViewIndex) 
router.GET("/images", galleryBaseController.GetImages) 

在我的控制器\ cars.go

func (controller CarController) CarsViewIndex(c *gin.Context) { 
     c.HTML(http.StatusOK, "carview.html", gin.H{ 
      "title": "Car Page"}) 
    } 

func (controller GalleryController) GetImages(c *gin.Context) { 
    imageList := controller.galleryService.FindImages(&bson.M{}) 
    c.JSON(http.StatusOK, &imageList) 
    fmt.Println(imageList) 
} 
我carview.html

        <div class="row mix-grid" ng-init="GetAllImages()" > 
            <div class="col-md-3 mix photography" ng-repeat="image in allimages"> 
             <div class="hover-effect" > 
              <div class="img" ><img src="imagesT/gallery/Thumb/{{image.imagename}}" alt="" 
                    class="img-responsive"/></div> 
              <div class="info"><h3>Manage Images</h3><a href="#" 
                           class="mix-link"><i 
                class="glyphicon glyphicon-link"></i></a><a 
                href="imagesT/gallery/{{image.imagename}}" data-lightbox="image-1" 
                data-title="Image 1" class="mix-zoom"><i 
                class="glyphicon glyphicon-search"></i></a></div> 
             </div> 
             this is the site fo cars 
             <a class="btn btn-default" href="carinfo">Learn More 
              <span class="glyphicon glyphicon-chevron-right"></span></a> 
            </div> 

           </div> 

当我进入http://localhost:3030/shopping每一件事工作正常,但如果ound这个错误

"NetworkError: 404 Not Found - 
http://localhost:3030/imagesT/gallery/Thumb/%7B%7Bimage.imagename%7D%7D" 

我不知道为什么这个错误,而每一件事情做工精细的发生,这一点,我发现那位与firbug什么:

<img class="img-responsive" alt="" src="imagesT/gallery/Thumb/2016-chevrolet-cruze-spied-completely-uncovered-news-car-and-driver-photo-658949-s-217x132.jpg"> 

回答

0

你有没有试着用ng-src代替src

0

如果您在IMG标签使用NG-SRC代替SRC,就可以解决这个问题。

采用了棱角分明的标记像{{哈希}}在src属性不起作用 权利:浏览器将网址提取与文字文本 {{哈希}},直到角代替内表达{ {散列}}。 ngSrc指令解决了这个问题。

检出文档here

+0

非常棒的网站感谢您的依靠 –

+0

你是什么意思@tigerprogrammer?这是官方的角度网站..无论如何请接受我的答案 – atefth