【问题标题】:How to make img source url working with ui-router如何使 img 源 url 与 ui-router 一起使用
【发布时间】:2015-10-16 22:04:45
【问题描述】:

我有一个小页面,只有一个路由,所以我定义它:

$locationProvider.html5Mode(true);
$stateProvider
            .state('main', {
                url: '/',
                views: {
                    'footer': {
                        templateUrl: baseUrl + 'footer.ng.html'
                    },
                    'header': {
                        templateUrl: baseUrl + 'header.ng.html'
                    },
                    'content': {
                        templateUrl: baseUrl + 'content.ng.html'
                    }
                }
            });

问题是:在 html 中,我有一个图像 <img ng-src="public/images/xetapdi.jpg" alt="Xe tập đi" />。此图无法显示。当我尝试在 chrome 中打开图像链接时,它会打开整个页面。虽然是图片的直接链接,但不显示图片。

我在流星上使用角度。请帮我解决这个问题。非常感谢。

【问题讨论】:

    标签: angularjs meteor angular-ui-router


    【解决方案1】:

    不应该是<img ng-src="/images/xetapdi.jpg" alt="Xe tập đi" />吗?路径的/public 部分不会反映到站点,基本上/public 正下方的每个目录都显示在根目录下。

    【讨论】:

    • 非常感谢。你节省了我的时间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-17
    • 1970-01-01
    • 2010-10-27
    • 2020-01-20
    • 1970-01-01
    • 2016-07-30
    • 2014-12-05
    相关资源
    最近更新 更多