我在做那个
$ rootScope.img =“http://graph.facebook.com/”+ success.authResponse.userID +“/ picture?type = large”;
我在横向菜单上有这个
<a class="item item-avatar" data-componentid="html9" style="
border-top-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-right-width: 0px;">
<img ng-model="avatar" ng-src="{{ img }}" style="max-width: 50px; max-height: 50px;">
</a>
问题是当我登录并从Facebook获取图像时,它不会在视图上刷新。
答案 0 :(得分:0)
制作research on the official docs,我找到了这个解决方案:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
$rootScope.img= "http://graph.facebook.com/" + uid + "/picture?type=large";
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
// the user isn't logged in to Facebook.
}
});
FB.getLoginStatus()
可让您确定用户是否已登录Facebook并已对您的应用进行身份验证。