Nothing shows up when a book is clicked

Hi I am stuck on step 8- I completed all of the steps, but when I click on a book from the home page the page empties out. Any advice? I am going to put up the code for the book.html steps


<a class="button back" href="#/books">Back</a>

<div class="book-detail">
<img ng-src="{{book.cover}}">
  <h3 class="title">{{book.title}}  </h3>
  <p class="author">{{}}  </p>
  <p class="description">{{book.description}}  </p>

  <a class="button" href="#/books/{{ currentBookIndex }}/chapters/0">Read</a>


<!doctype html>
    <link href=',700,300,900' rel='stylesheet' type='text/css'>
    <link href="" rel="stylesheet" />
    <link href="css/main.css" rel="stylesheet" />
    <script src="js/vendor/angular.min.js"></script>
    <script src=""></script>
  <body ng-app="ReaderApp">
    <div class="header">
      <div class="container">

    <div class="main">
      <div class="container">
        <div ng-view>

    <!-- Modules -->
    <script src="js/app.js"></script>

    <!-- Controllers -->
    <script src="js/controllers/BookshelfController.js"></script>
    <script src="js/controllers/BookController.js"></script>
    <script src="js/controllers/ChapterController.js"></script>

    <!-- Services -->
    <script src="js/services/books.js"></script>



app.controller('ChapterController', ['$scope', 'books', '$routeParams', function($scope, books, $routeParams) {
  books.success(function(data) {
		$ = data[$routeParams.bookId];


  // Using this property to create the URL in line 9 of views/book.html
  $scope.currentBookIndex = parseInt($routeParams.bookId);


app.factory('books', ['$http', function($http) {
  return $http.get('')
  	.success(function(data) {
    	return data;
  	.error(function(err) {
    	return err;


var app = angular.module('ReaderApp', ['ngRoute']);

app.config(function ($routeProvider) {
  	.when('/books', {
    	controller: 'BookshelfController',
    	templateUrl: 'views/bookshelf.html'
  	.when('/books/:bookId', {
    	controller: 'BookController',
    	templateURL: 'views/book.html'
  	.when('/books/:bookId/chapters/:chapterId',  {
    	controller: 'ChapterController',
    	templateURL: 'views/chapter.html'
    	redirectTo: '/books'

I believe the problem is in your initial function in the bookController.js, after the dependencies it should be this:

app.controller('BookController', ['$scope', 'books', '$routeParams', function($scope, books, $routeParams) {

you have to add the service name in the function between scope and $routeParams

Looks like you are missing ng-repeat.

He doesn’t need ng-repeat when it comes to showing a single book.

i tried updating the bookcontroller.js with this

app.controller('BookController', ['$scope', 'books', '$routeParams', function($scope, books, $routeParams) {

But still no success

Indeed :slight_smile: Sorry @megdollar, I was too hasty with my reply.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.