You need to use a service since a service will persist throughout your app's life.
Lets say you want to save data pertaining to a user
This is how you define the service :
app.factory("user",function(){
return {};
});
In your first controller:
app.controller( "RegistrationPage1Controller",function($scope,user){
$scope.user = user;
// and then set values on the object
$scope.user.firstname = "John";
$scope.user.secondname = "Smith";
});
app.controller( "RegistrationSecondPageController",function($scope,user){
$scope.user = user;
// and then set values on the object
$scope.user.address = "1, Mars";
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…