I\'m getting to know AngularJS and I have an interesting problem. I\'m getting to know the routeProvider and I thought I could write my app like if you search a table name,
From $routeParams docs:
Note that the $routeParams are only updated after a route change completes successfully. This means that you cannot rely on $routeParams being correct in route resolve functions. Instead you can use $route.current.params to access the new route's parameters.
So just inject $route
instead of $routeParams
:
resolve: {
tables: function($http, $route){
return $http.get('http://mywebsite.com/doc/ajax/table.php?function=get_table_data&table='+$route.current.params.table)
.then(function(response){
return response.data;
})
}
}