使用angularjs使用linkedin构建登录

时间:2018-06-18 09:34:21

标签: angularjs

<script type="text/javascript" src="http://platform.linkedin.com/in.js">
      //here goes the api key, and the callback function
      api_key: <api_key>
      authorize: false
    </script>

    //execute on login event
function onLinkedInLogin() {
   // pass user info to angular
   angular.element(document.getElementById("appBody")).scope().$apply(
   function($scope) {
      $scope.getLinkedInData();
   });
}

   $scope.getProfileData = function() {
      if(!$scope.hasOwnProperty("userprofile")){

      IN.API.Profile("me").fields(
      [ "id", "firstName", "lastName", "pictureUrl",
      "publicProfileUrl" ]).result(function(result) {
      // set the model
      $rootScope.$apply(function() {
      var userprofile = result.values[0];
      $rootScope.userprofile = userprofile;
      $rootScope.loggedUser = true;
      //go to main
      $location.path("/dashboard");
      });
      }).error(function(err) {
      $scope.error = err;
      });
      }
      };

我收到了linkedin按钮。当我点击它它消失所有的东西,永远不会转移页面。我该如何实现呢?

0 个答案:

没有答案