please help me, this code is a crucial part of a project I have to hand in and I just can't find the problem.
Here is the link to the files on GitHub. https://github.com/PouncingPoodle/LibApp
This application worked perfectly a few days ago on my computer at University, but when I got home, I changed only the paths that HAS to change, but now the app doesn't work anymore. Please help!
So what I'm doing is: I want to show some details from the items in the database in my html document by using angularJS. It shows the "Test before" text but not the "Test after" so there must be a problem onward from the div with the ng-repeat. I checked the "book" / "books" / "info" all those names to be correct and all paths are correct.
This is my html code
<html ng-app="lib">
<div ng-controller="BooksController as books">
<p>Test before</p>
<div ng-repeat="book in (books.info | orderBy: 'title' | limitTo: 3)">
<p>{{book.id}}</p>
<p>{{book.genre}}</p>
<p>{{book.title}}</p>
<p>Test after</p>
</div>
</div>
scripts/dbcon.php Connect to the database, get the information and add to an array $results[]
$app->get('/book', function () {
// these details is correct on my computer
$bookDBconnect = mysqli_connect("localhost","root","","lib_db");
if (mysqli_connect_errno()) {
echo "Failed to connect to". mysqli_connect_error();
}
$result = mysqli_query($bookDBconnect,"SELECT * FROM books");
$results = array();
while ($row = mysqli_fetch_array($result))
{
$mybook = new Book;
$mybook->id = $row['id'];
//more fields
// this echo shows the correct details
//echo json_encode($mybook);
$results[] = $mybook;
}
echo json_encode($results);
mysqli_close($bookDBconnect);
});
$app->run();
scripts/app.js Get all the data from the database and send it to my "info" to show in my html
(function(){
var app = angular.module('lib', []);
app.controller('BooksController', ["$http", function($http)
{
var storage = this;
//this path is correct on my computer
$http.get("http://localhost/OW/idvProject6/scripts/dbcon.php/book").success(function(data)
{
storage.info = data;
});
}]);
})();
Thank you guys