我的 index.html 中有标准的 LinkedIn JSAPI 脚本:
<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script>
我正在使用 Angular.js 并在我的登录页面中有此代码:
<button class="btn btn-primary" ng-click="FBlogin()">Connect with Facebook</button>
<script type="in/Login" data-onAuth="getLinkedInProfile"></script>
<script type="text/javascript">
// upon getting in.js above, apply to register window scope
function getLinkedInProfile() {
IN.API.Profile("me").fields(["id", "firstName", "lastName", "email-address", "picture-urls::(original)", "industry", "languages", "educations", "three-current-positions", "three-past-positions"])
.result(function(me) {
angular.element(document.getElementById('login_window')).scope().linkedInRegistration(me) // calls scope function
})
.error(function(error) {
console.log('>> error on LinkedInLoad', error)
})
}
</script>
在某些随机的机会中,按钮根本不会出现。我有点注意到,如果我删除了所有 fields() 选项,那么按钮将可靠地显示出来,但如果这是原因,我不会。有什么建议么?