mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){ /* Create profile structure to store informations * about current session */ var profile={}; profile.username=null; profile.projectname=null; profile.token=null; /* var tokenFragment=9; var saveTokenInCookies=function(){ var i=0; var currentStart=0; var currentEnd=parseInt(profile.token.length/tokenFragment); var facto=currentEnd; alert("current ren" + currentEnd); for(i=0;i