Angular Session storage doesn't work
<p>I make a login page and when A person is authenticated, the page create a token and this token is saved in a session storage (see the session storage variable here: <a href="https://imgur.com/a/koxaE" rel="nofollow noreferrer">http://imgur.com/a/koxaE</a>)
but if I change page, session storage is null (see it here:<a href="https://imgur.com/a/RBFlx" rel="nofollow noreferrer">http://imgur.com/a/RBFlx</a>)
I want that this token is passed to this second page, using session storage and I don't know why this doesn't works. This is my login.html (html where there are the session):</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;!-- saved from url=(0066)https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/signin/ --&gt;
&lt;html lang="en"&gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;meta name="description" content=""&gt;
    &lt;meta name="author" content=""&gt;
    &lt;link rel="shortcut icon" href="images/puzzle.png" /&gt;


    &lt;title&gt;Login&lt;/title&gt;

    &lt;link href="./styles/bootstrap.min.css" rel="stylesheet"&gt;

    &lt;link href="./styles/signin.css" rel="stylesheet"&gt;



    &lt;!--[if lt IE 9]&gt;
      &lt;script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"&gt;&lt;/script&gt;
      &lt;script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"&gt;&lt;/script&gt;
    &lt;![endif]--&gt;
  &lt;/head&gt;

  &lt;body ng-app="StaffManagement" ng-controller="LoginController" ng-fa&gt;

    &lt;div class="container"&gt;

      &lt;form class="form-signin" role="form" ng-controller="LoginController" ng-submit="submitCredentials()" novalidate&gt;
        &lt;h2 class="form-signin-heading"&gt;Hai bisogno di autenticarti&lt;/h2&gt;
        &lt;input type="email" class="form-control" placeholder="Email address" required="" autofocus="" id="email" ng-model="staffLoginForm.email"&gt; 
        &lt;input type="password" class="form-control" placeholder="Password" required="" id="password" ng-model="staffLoginForm.pass"&gt;
        &lt;label class="checkbox"&gt;
          &lt;input type="checkbox" value="remember-me"&gt; Ricordami
        &lt;/label&gt;
        &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;Sign in&lt;/button&gt;
      &lt;/form&gt;

    &lt;/div&gt; 


  
    &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"&gt;&lt;/script&gt; 
    &lt;script src="scripts/angular.js"&gt;&lt;/script&gt;
    &lt;script type="application/javascript"&gt;&lt;/script&gt;
    &lt;script src="scripts/login-controller.js"&gt;&lt;/script&gt;
    &lt;script src="scripts/rest-services.js"&gt;&lt;/script&gt;

&lt;/body&gt;&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>This is login-controller.js (where create the session):</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var app = angular.module("StaffManagement", []);  

app.controller("LoginController", function($scope, $http, restService) {  
    $scope.stafflogins = [];
    $scope.staffLoginForm = {  
        email: "",
        pass: ""
    };
    $scope.tokenStaffForm = {  
        idtokenstaff: -1,    
        tokenstaff: ""
    };  
    $scope.staffForm = {  
        idstaff : -1,    
        staffType: {
            idstaffType: -1,
            type: ""
         },
        name: "",
        surname: "",
        birthDate: "",
        phone: "",
        gender: true,
        working: true,
        staffLogin: {
            idstaffLogin: -1,
            email: "",
            pass: "" 
          }
    };  
    

    $scope.submitCredentials= function() { 
        restService.login($scope.staffLoginForm, _logsuccess, _logerror);
  
            
                }

            
    function _logsuccess(response) {  
        console.log("Loggato correttamente");
        console.log(response.status);
        var CurrentToken = response.data;
                                   
    }  
            
    function _logerror(response) {  
        console.log("Login fallito");
        console.log(response.status);
                                          
    } 
       
                    
     console.log(sessionStorage.getItem.toString);
    });</code></pre>
</div>
</div>
</p>

<p>This is the second page (edit_employee.html):</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    
    &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;meta name="description" content=""&gt;
    &lt;meta name="author" content=""&gt;

    &lt;link rel="shortcut icon" href="images/puzzle.png" /&gt;
      
    &lt;link rel="stylesheet" href="bootstrap/css/bootstrap.css" /&gt;
    &lt;link rel="stylesheet" href="styles/angular-bootstrap-datepicker.css" /&gt;
    &lt;link rel="stylesheet" href="styles/mainBoot.css"&gt;
    &lt;link rel="stylesheet" href="styles/scrollbar.css"&gt;
    &lt;link rel="stylesheet" href="styles/noscroll_numberfield.css"&gt;
    
 
    
    &lt;title&gt;Pannello dipendenti&lt;/title&gt;

    &lt;link href="./styles/bootstrap.min.css" rel="stylesheet"&gt;
    &lt;link href="./styles/dashboard.css" rel="stylesheet"&gt;
    &lt;!--[if lt IE 9]&gt;
      &lt;script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"&gt;&lt;/script&gt;
      &lt;script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"&gt;&lt;/script&gt;
    &lt;![endif]--&gt;
  &lt;style id="holderjs-style" type="text/css"&gt;&lt;/style&gt;&lt;/head&gt;

  &lt;body ng-app="StaffManagement" ng-controller="StaffController" background="images/sfondoblu3.png"&gt;

    &lt;div class="navbar navbar-inverse navbar-fixed-top" role="navigation"&gt;
      &lt;div class="container-fluid"&gt;
        &lt;div class="navbar-header"&gt;
          &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"&gt;
            &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;/button&gt;
          &lt;a class="navbar-brand"&gt;FDDispenser&lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="navbar-collapse collapse"&gt;
          &lt;ul class="nav navbar-nav navbar-right"&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Pannello Dipendenti&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Settings&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Profile&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Help&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;form class="navbar-form navbar-right"&gt;
            &lt;input type="text" class="form-control" placeholder="Search..."&gt;
          &lt;/form&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="container-fluid"&gt;
      &lt;div class="row"&gt;
        &lt;div class="col-sm-3 col-md-2 sidebar"&gt;
          &lt;ul class="nav nav-sidebar"&gt;
            &lt;li class="active"&gt;&lt;a href="edit_employee.html"&gt;Aggiungi/Modifica Dipendente&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Reports&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Analytics&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/#"&gt;Export&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;ul class="nav nav-sidebar"&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;Nav item&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;Nav item again&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;One more nav&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;Another nav item&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;More navigation&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;ul class="nav nav-sidebar"&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;Nav item again&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;One more nav&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="https://hackerstribe.com/guide/IT-bootstrap-3.1.1/examples/dashboard/"&gt;Another nav item&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
        &lt;div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"&gt;
          &lt;h1 style="color:#4e67c3;" class="page-header"&gt;Aggiungi/Modifica dipendenti&lt;/h1&gt;

          &lt;form ng-submit="submitStaff()"&gt;  
            
            &lt;table&gt;  
                 
                &lt;tr&gt;  
                    &lt;th colspan="4" class="th2"&gt;Aggiungi/Modifica dipendente&lt;/th&gt;  
                 &lt;/tr&gt;  
                &lt;tr&gt;  
                    &lt;td&gt;Nome&lt;/td&gt;  
                    &lt;td&gt;&lt;input type="text" ng-model="staffForm.name" pattern="[a-zA-Z\s]+" ng-pattern-restrict/&gt;&lt;/td&gt;  
                    &lt;td&gt;Cognome&lt;/td&gt;  
                    &lt;td&gt;&lt;input type="text" ng-model="staffForm.surname" pattern="[a-zA-Z'\s]+" ng-pattern-restrict/&gt;&lt;/td&gt;  

                   
                &lt;/tr&gt; 
                &lt;tr&gt;  
                    &lt;td&gt;Data di Nascita&lt;/td&gt;  
                     &lt;td&gt; &lt;input id="datepicker" type="text" data-ng-datepicker data-ng-options="datepickerOptions" ng-model="staffForm.birthDate"&gt;&lt;/td&gt;
                    &lt;td&gt;Telefono&lt;/td&gt;  
                    &lt;td&gt;&lt;input type="number" ng-model="staffForm.phone"/&gt;&lt;/td&gt;

                &lt;/tr&gt;  
                &lt;tr&gt;  
                    &lt;td&gt;Sesso&lt;/td&gt;  
                    &lt;td&gt;&lt;select ng-model="staffForm.gender" ng-options="opt.type as opt.name for opt in selectg" &gt;&lt;/td&gt; 
                         &lt;td&gt;Email&lt;/td&gt;  
                    &lt;td&gt;&lt;input type="text" ng-model="staffForm.staffLogin.email" /&gt;&lt;/td&gt;      
                                                                     
                &lt;/tr&gt;  

                &lt;tr&gt;  
                    &lt;td colspan="4" &gt;&lt;input  style="width:200px" onmouseover="this.className='button2'" onmouseout="this.className='blue-button'" type="submit" value="Invia" class="blue-button" /&gt;&lt;/td&gt;  
                &lt;/tr&gt;   
            &lt;/table&gt;  
        &lt;/form&gt;

          &lt;h2 class="sub-header" style="color:#4e67c3;"&gt;Dipendenti&lt;/h2&gt;
          &lt;div class="table-responsive"&gt;
            &lt;form ng-submit="submitStaff()"&gt;
            &lt;table id="thetable" class="scrollable"&gt;
                &lt;tbody&gt;
             
                &lt;tr&gt; 
                    &lt;th class="th2"&gt;Nome&lt;/th&gt;  
                    &lt;th class="th2"&gt;Cognome&lt;/th&gt;  
                    &lt;th class="th2"&gt;Data di Nascita&lt;/th&gt;   
                    &lt;th class="th2"&gt;Telefono&lt;/th&gt;  
                    &lt;th class="th2"&gt;Sesso&lt;/th&gt; 
                    &lt;th class="th2"&gt;StaffId&lt;/th&gt;
                    &lt;th class="th2"&gt;Email&lt;/th&gt; 
                    &lt;th class="th2"&gt;Azioni&lt;/th&gt; 
             &lt;/tr&gt; 
             
              
              &lt;tr ng-repeat="staff in staffs"&gt;  
                 
            &lt;td&gt; {{ staff.name }}&lt;/td&gt;  
            &lt;td&gt; {{ staff.surname }}&lt;/td&gt;    
            &lt;td&gt; {{ staff.birthDate }}&lt;/td&gt;
            &lt;td&gt; {{ staff.phone }}&lt;/td&gt; 
            
   
            &lt;td&gt;
                &lt;div ng-switch on="staff.gender"&gt;
                &lt;span ng-switch-when="true"&gt;Uomo&lt;/span&gt;
                &lt;span ng-switch-when="false"&gt;Donna&lt;/span&gt;
                &lt;/div&gt;
            &lt;/td&gt;
                    
            
            &lt;td&gt; {{ staff.idstaff }}&lt;/td&gt;  
            &lt;td&gt; {{ staff.staffLogin.email }}&lt;/td&gt; 
    
                  
                &lt;td&gt;
                    &lt;a onmouseover="this.className='button2'" onmouseout="this.className='blue-button'" ng-click="editStaff(staff)" class="blue-button"&gt;Edit&lt;/a&gt;&lt;a onmouseover="this.className='button2'" onmouseout="this.className='red-button'" ng-click="deleteStaff(staff)" class="red-button"&gt;Delete&lt;/a&gt;
                &lt;/td&gt;  

            &lt;/tr&gt;  
              &lt;/tbody&gt;
            &lt;/table&gt;
                 &lt;div id="snackbar"&gt;Success&lt;/div&gt;
    &lt;div id="snackbar_nofield"&gt;Inserisci tutti i campi&lt;/div&gt;
    &lt;div id="snackbar_invalid"&gt;Hai inserito dati non validi&lt;/div&gt;
            &lt;/form&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;

  
    &lt;script src="./scripts/bootstrap.min.js.download"&gt;&lt;/script&gt;
    &lt;script src="./scripts/docs.min.js.download"&gt;&lt;/script&gt;
               
    &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"&gt;&lt;/script&gt; 
  

 &lt;script src="scripts/deployeePanel.js"&gt;&lt;/script&gt;
      &lt;script src="scripts/rest-services.js"&gt;&lt;/script&gt;
    &lt;script src="scripts/jquery.js"&gt;&lt;/script&gt;
    &lt;script src="bootstrap-3.3.7-dist/js/bootstrap.js"&gt;&lt;/script&gt;
    &lt;script src="scripts/angular.js"&gt;&lt;/script&gt;
 
    &lt;script src="scripts/angular-bootstrap-datepicker.js" charset="utf-8"&gt;&lt;/script&gt;
  
    &lt;script type="application/javascript"&gt;&lt;/script&gt;
    
  

&lt;/body&gt;&lt;/html&gt;</code></pre>
</div>
</div>
</p>

<p>and this is the js associated to the second page called deployeePanel.js:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>.module("StaffManagement", ['ng-bootstrap-datepicker']);  
               
  
                app.controller("StaffController", function($scope, $filter, $http, restService) {  
                    
                     
                    $scope.staffs = [];  
                    $scope.staffLast = [];  
                    $scope.staffForm = {  
                          idstaff : -1,    
                            staffType: {
                            idstaffType: 2,
                            type: "Dipendente"
                          },
                          name: "",
                          surname: "",
                          birthDate: "",
                          phone: "",
                          gender: true,
                          working: true,
                          staffLogin: {
                            idstaffLogin: -1,
                            email: "",
                           // pass: "",
                             
                          }
                    };  
                    
                    $scope.staffLoginForm = {  
                          idstaffLogin: -1,
                          email: "",
                    };  
                    
                    $scope.selectg = [
                         {name:'uomo', type: true},
                         {name:'donna', type: false}
                    ];
                    
                    $scope.dateold = {
                        getdateold: ""
                        };
                    
                     $scope.datepickerOptions = {
                        format: 'yyyy/mm/dd',
                        language: 'it',
                        startDate: "01/01/1900",
                        endDate: new Date(),
                        autoclose: true,
                        weekStart: 1
                         };
                    
    
                    
              
                     $scope.wks =  {number: 1, name: 'testing'};

                    
                    console.log($scope.staffForm.gender);
               

                    _refreshStaffData();  
               
           $scope.submitStaff = function() {  
                        console.log($scope.staffForm);   
                        if($scope.staffForm.name == "" || $scope.staffForm.surname == ""  || $scope.staffForm.staffLogin.email == "" || $scope.staffForm.birthDate == "" || $scope.staffForm.phone == "" || $scope.staffForm.gender == null || $scope.staffForm.idstaff == null)
                               _showSBNoField();   
                        else if(!_emailCheck($scope.staffForm.staffLogin.email))
                                _showSBInvalid();
                            

                        else{
                            if ($scope.staffForm.idstaff == -1) {  
                                console.log("StaffLogin");
                                console.log($scope.staffForm.staffLogin);
                                console.log($scope.staffForm);

                                $scope.staffForm.birthDate = $filter('date')(new Date($scope.staffForm.birthDate), "yyyy-MM-dd");  
                                console.log( $scope.staffForm.birthDate);
                                restService.insertstaff($scope.staffForm, _giveLast, _error);



                            } else {  

                                $scope.staffForm.birthDate = $filter('date')(new Date($scope.staffForm.birthDate), "yyyy-MM-dd");  
                                console.log( $scope.staffForm.birthDate);


                                
                                restService.updatestaff($scope.staffForm, _giveLast, _error);
                                
                   
                            } 

                            console.log("HTTP: ");
                            console.log($http);
                            console.log($scope.staffForm.gender);
                            console.log($scope.staffForm.idstaff);
                        }   
                    };  


                    
                     $scope.deleteStaff = function(staff) {  
                         $scope.staffForm.name = staff.name;  
                         $scope.staffForm.idstaff = staff.idstaff; 
                         $scope.staffForm.surname = staff.surname;   
                         $scope.staffForm.birthDate = staff.birthDate;  
                         $scope.staffForm.phone = staff.phone; 
                         $scope.selectg.type = staff.gender;  
                         $scope.staffForm.staffLogin.email = staff.staffLogin.email;
                         $scope.staffForm.staffLogin.staff = "";
                         $scope.staffForm.working = false;  
                         console.log(staff.staffLogin.email);
                         $http({  
                                method : 'PUT',  
                                url : 'http://localhost:8080/FoodDrinkDispener/rest/staff',  
                                data : angular.toJson($scope.staffForm),  
                                headers : {  
                                    'Content-Type' : 'application/json'  
                                }
                            }).then( _success, _error ); 
                        }  
                 
       
                    $scope.editStaff = function(staff) {  
                        

                        $scope.staffForm.name = staff.name;  
                        $scope.staffForm.idstaff = staff.idstaff; 
                        $scope.staffForm.surname = staff.surname;   

(staff.birthDate, "mm/dd/yyyy");  
                        $scope.staffForm.birthDate = staff.birthDate;
                         console.log($scope.staffForm.birthDate);
(staff.birthDate, "yyyy-MM-dd");  

                        $scope.staffForm.phone =  parseInt(staff.phone, 10);  
                        $scope.staffForm.gender = staff.gender;  
                        $scope.selectg.type = staff.gender;  
                        $scope.staffForm.staffLogin.email = staff.staffLogin.email;
                        $scope.staffForm.staffLogin.staff = "";

                        console.log(staff.staffLogin.email);
                    };  
                
                    function _refreshStaffData() {  

                        var Headers = {
                            strngot: currentToken
                        }

   
                        restService.allstaffworking(_getstaff);
 
                    
                    function _getstaff(response){
                        $scope.staffs = response.data;  
                    }
               
                    function _success(response) {  
                        console.log("successo");
                        
                        _refreshStaffData();  
                        _clearFormData();
                        _showSB();
                        console.log("cleared");
                    
                    }  
               
                    function _error(response) {  
                    }  
               
                    function _clearFormData() {  
                        $scope.staffForm.idstaff = -1; 
                        $scope.staffForm.name = "";  
                        $scope.staffForm.surname = "";   
                        $scope.staffForm.birthDate = "";  
                        $scope.staffForm.phone = ""; 
                        $scope.staffForm.gender = true;
                        $scope.staffForm.staffLogin.idstaffLogin = -1;
                        $scope.staffForm.staffLogin.email = "";
                        $scope.staffForm.staffType.idstaffType=2;
                        $scope.staffForm.working= true;
                   
                        
                    };  
                    
                    function _giveLast(){ 


                        restService.laststaff(_postStaffLogin);
                                              
                    }
               
                
                    function _postStaffLogin(response){ 
                        $scope.staffLast = response.data;

                                                
                        $scope.staffLoginForm.idstaffLogin = $scope.staffLast.idstaff;
                        $scope.staffLoginForm.email = $scope.staffForm.staffLogin.email;

                         $http({  
                            method : 'POST',  
                            url : 'http://localhost:8080/FoodDrinkDispener/rest/stafflogin',  
                            data : angular.toJson($scope.staffLoginForm),  
                            headers : {  
                                'Content-Type' : 'application/json'  
                            }  
                        }).then( _success, _error); //se errore allora DELETE staff, altrimenti sta stessa stafflogin   
                    }
                    
                     function _putStaffLogin(){ 

                        $scope.staffLoginForm.idstaffLogin = $scope.staffForm.idstaff;
                        $scope.staffLoginForm.email = $scope.staffForm.staffLogin.email;

       
                         $http({  
                            method : 'PUT',  
                            url : 'http://localhost:8080/FoodDrinkDispener/rest/stafflogin',  
                            data : angular.toJson($scope.staffLoginForm),  
                            headers : {  
                                'Content-Type' : 'application/json'  
                            }  
                        }).then( _success, _error );  
                    }
                    
                    function _showSB() {

                        var x = document.getElementById("snackbar")

                        x.className = "show";

                        setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
                    }
                    
                    function _showSBNoField() {
   
                        var x = document.getElementById("snackbar_nofield")

                        x.className = "show";

                        setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
                    }
                    
                     function _showSBInvalid() {
                  var x = document.getElementById("snackbar_invalid")

   
                        x.className = "show";

                        setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
                    }
                    
                    function _isDate(value) {
                        return toString.call(value) === '[object Date]';
                    }
                    
                    
                    function _emailCheck(emailStr) {
                        var emailPat = /^(.+)@(.+)$/;
                        var specialChars = "\\(\\)&lt;&gt;@,;:\\\\\\\"\\.\\[\\]";
                        var validChars = "[^\\s" + specialChars + "]";
                        var quotedUser = "(\"[^\"]*\")";
                        var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
                        var atom = validChars + "+";
                        var word = "(" + atom + "|" + quotedUser + ")";
                        var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
                        var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$");
                        var matchArray = emailStr.match(emailPat);
                        if (matchArray == null) {
                            alert("L'email sembra essere sbagliata: (controlla @ e .)");
                            return false;
                        }
                        var user = matchArray[1];
                        var domain = matchArray[2];
                        if (user.match(userPat) == null) {
                            alert("La parte dell'email prima di '@' non sembra essere valida!");
                            return false;
                        }
                        var IPArray = domain.match(ipDomainPat);
                        if (IPArray != null) {
                            for (var i = 1; i &lt;= 4; i++) {
                                if (IPArray[i] &gt; 255) {
                                    alert("L'IP di destinazione non è valido!");
                                    return false;
                                }
                            }
                            return true;
                        }
                        var domainArray = domain.match(domainPat);
                        if (domainArray == null) {
                            alert("La parte dell'email dopo '@' non sembra essere valida!");
                            return false;
                        }
                        var atomPat = new RegExp(atom, "g");
                        var domArr = domain.match(atomPat);
                        var len = domArr.length;
                        if (domArr[domArr.length - 1].length &lt; 2 ||
                            domArr[domArr.length - 1].length &gt; 6) {
                            alert("Il dominio di primo livello (es: .com e .it) non sembra essere valido!");
                            return false;
                        }
                        if (len &lt; 2) {
                            var errStr = "L'indirizzo manca del dominio!";
                            alert(errStr);
                            return false;
                        }
                        return true;
                 }
                
     
          }); </code></pre>
</div>
</div>
</p>

<p>I hope that somebody can help me</p>