I am using Ionic and Angular to create a mobile application and need to pass data between two controllers/views.
.controller('SearchCtrl', function($scope, $state, $http) {
$scope.search = function() {
console.log('Starting search..');
var res = $http.post('http://endpoint:8080/search',{"language":"en"})
.success(function(data) {
//take the data.results and make sure its available when I move to tab.search-results
alert("Search OK");
})
.error(function(data) {
alert("Search Bad");
});
//take the data.results and make sure its available when I move to tab.search-results
$state.go('tabs.search-results');
};
})
So when I do the $state.go('tabs.search-results') I want to make sure the data returned from search is available for loading in the new view. This is probably really obvious but I am struggling to find a solution.