如何使img源url使用ui-router

时间:2015-07-26 19:14:35

标签: angularjs meteor angular-ui-router

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

$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中打开图片链接时,它会打开我的页面。通过这是图像的直接链接,它不显示图像。

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

1 个答案:

答案 0 :(得分:0)

不应该是{ rules: { "usernames": { "$username": { // can only write if there is no data in this place yet AND // the user can only write their own data ".write": "!data.exists() && newData.val() == auth.uid", } }, "users": { "$uid": { "username": { // validate that the /username/$username has out $uid associated with it ".validate": "root.child('usernames').child(newData.val()).val() == $uid" } } } }} 吗?路径的<img ng-src="/images/xetapdi.jpg" alt="Xe tập đi" />部分未反映到网站,基本上/public下面的每个目录都显示在根目录中。