search

Home  >  Q&A  >  body text

angular.js - angularjs permissions issue

In the angularjs project, some functions require logging in to access. Now I can only control whether the user is logged in when clicking on the navigation. If the user is accessed directly using a link, I cannot determine whether the user is logged in. Here’s my method

$scope.login = function(){
    $scope.unlogin = false;
    //登录操作
}
$scope.login = function(){
    $scope.unlogin = true;
    //退出操作
}
<a ng-if="unlogin" ui-sref="login">我的收藏</a>
<a ng-if="!unlogin" ui-sref="myData">我的收藏</a>

To achieve this, users can check whether they are logged in by directly accessing the link. What should be done?

習慣沉默習慣沉默2845 days ago573

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-05-15 17:12:42

    Successful login, save a cookie, and then determine the cookie

    reply
    0
  • Cancelreply