I am working with Angular JS (1.x) in which I have one html page (find.html) which has submit button.
When user click on submit button, it performs some search query then it redirects to another html page (result.html) which should display the result of search query.
Both files share the same controller. But when user move to result.html, he can't see the final result as $scope gets die.
how to resolve this issue?
Edit: I used a shared service between two pages. Below is my service code:
app.factory("getSharedDataService",function(){
var resultData = {};
function setResultData(obj){
resultData.status = obj.status;
resultData.planet_name = obj.planet_names;
}
function getResultData(){
return resultData;
}
return { getResultData: getResultData,
setResultData: setResultData };
});
I used my controller to set the value of resultData when the scope is in first page. But when I try to fetch the value of resultData after reaching to result.html, it comes undefined..