我無法使用角度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..
}
});
}
你應該澄清的是工作的標題多一點點 – nick