通过angularjs显示,但在控制台警告错误的Facebook图片 [英] facebook picture displayed by angularjs but warning error in console

查看:132
本文介绍了通过angularjs显示,但在控制台警告错误的Facebook图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个angularjs应用,在那里我显示的Facebook的个人资料图片,如:

I made a angularjs app where i displayed facebook profile picture, like this :

<div class="avatar">
    <img src="http://graph.facebook.com/{{comment.from.id}}/picture" />
</div>

照片正确显示:像 http://graph.facebook.com/4/picture

但在控制台中有一个错误:

But in console there is a error :

GET http://graph.facebook.com/%7B%7Bcomment.from.id%7D%7D/picture 404 (Not Found)

所以,因为图片有一个重定向,这个错误的正常的?

推荐答案

您说得对,既然你有src属性里面的动态变量,出现问题而重定向。

You're right, since you have dynamic variables inside the src attribute, the problem occurs while the redirection..

使用 NG-SRC 而不是

有关如

<img ng-src="http://graph.facebook.com/{{comment.from.id}}/picture"/>

这篇关于通过angularjs显示,但在控制台警告错误的Facebook图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆