//login.js
angular.module('myApp')
  .controller('LoginCtrl', function ($scope, Auth, $rootScope, $sessionStorage, permissions) {
      $scope.user = { username : 'admin', password : 'admin123' };
      $scope.authendicateUser = function(){
          Auth.login($scope.user.username, $scope.user.password)
              .success(function(data){
                  if(data.token) {
                      $rootScope.userDetail = data.userDetail;
                      $rootScope.userDetail.permissionList = ['create-user','update-user','delete-user','view-user'];
                      permissions.setPermissions( $rootScope.userDetail.permissionList);
                      $sessionStorage.userDetail = $rootScope.userDetail;
                      $state.go('dashboard');
                  }
          });
     };
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js