You could store your information into the LocalStorage maybe use a service too. i.e
Save In local storage
app.service('teamStorage', function() {
var teamId;
var teamName;
//to save the data send it as a parameter obj
this.saveTeam = function(data) {
teamId = data.teamId;
teamName = data.teamName;
localStorage.setItem('teamInfo', JSON.stringify({
teamName: teamName,
teamId: teamId,
}));
};
//to clear your localstorage
this.clearTeam = function() {
localStorage.removeItem('teamInfo');
teamName = "";
teamId = "";
};
//in case you want to get independent variables
this.getTeamID = function() {
return teamId;
};
this.getTeamName = function (){
return teamName;
}
});
Inject the service to your controller
app.controller('teamController', function($scope, teamStorage) {
//you can access your localStorage on load like this
var myLocalStorage = localStorage.getItem('teamInfo');
$scope.save = function(teamId) {
var data = {
teamID:teamId,
teamName: myTeam
}
//save team in LocalStorage
teamStorage.saveTeam(data);
};
//clear team from LocalStorage
teamStorage.ClearTeam();
//get name of team
$scope.myTeam = teamStorage.getTeamName();
});