我无法使用 Angular js 打印 fb 名称。我不确定出了什么问题。在下面的代码中,“no_name”被打印出来。JSON 警报正确显示。
I have this view code trying to print l from the scope
<div ng-controller="TestCtrl">
{{n}}
</div>
This is the controller code:
function TestCtrl($scope){
$scope.n="no_name";// default value
FB.login(function(response) {// fb login as soon as the ui loads
if (response.authResponse) {
FB.api('/me', function(response) {
alert(JSON.stringify(response));
$scope.n=response.name;
});
} else {
//do nothing..
}
});
}