I have two tables in my page, and upon clicking on a row on the first table, i wanted to call an ajax request to update the second table.
I'm trying to do this with two controllers, each of them with an ng-repeat filling the rows with values. I've burned out every neuron i could afford and I'm still stumped.
This is my code
app.controller("TermsCtrl", function($scope, $http) {
$http.get('json.php').then(function(res) {
$scope.wordfreq = res.data;
$scope.decodeURIComponent = decodeURIComponent;
$scope.unescape = unescape;
});
$scope.go = function(id) { // This makes the rows clickable and calls the next results
return $http.get('json2.php?word=' + id).then(function(result) {
secondtable = result.data;
console.log(secondtable); // I see the objects!
return secondtable;
});
};
});
app.controller("TermsCtrl2", function($scope, secondtable) {
$scope.secondfeq = secondtable;
console.log(scope.secondfeq); // No dice
});
Any ideas how to get the secondtable
results from the click into the TermsCtrl2
controller?
cheers