I have an app that's completely a 'round trip' app, as AngularJS would put it. I'm setting up a sidebar to use AngularJS but I'm a bit confused about next steps. Have the following example placed on my page just as a starting point (one of their homepage examples, no big win here):
What I'd like to do is figure out how to get data from my database rather than hard coding this:
$scope.todos = [{
text: 'learn angular',
done: true },{
text: 'build an angular app',
done: false
}];
I'm happy to set up a table with just these two field for purposes of essentially completing this tutorial. From what I've read, a good way to go seems to be configuring an API, but that isn't something I really want to dive into right now. I just have normal models that return arrays, as specified by a single query.
Can anyone shed some light about how I can do this? I'm working in Codeigniter as my server side framework.
Thanks!
You can get your data with $http
For example:
$http({
url: "some url here",
method: "POST",
data: {"key":"value"}
}).success(function(data, status, headers, config) {
$scope.data = data;
}).error(function(data, status, headers, config) {
$scope.status = status;
});
Or you can use $resource, the documentation is here