10. ng-click II: At instruction 3 : Error: Oops! The test returned an error. Maybe you have a syntax error, or a typo. Hide error. WARN [karma]: Port 9876 in use


#1

I'm getting this strange error (most probably some kind of backend error) while I'm at instruction 3 of ng-click II and thus cannot progress any further. Step 3 also takes very long to review the code.


#2

I've been getting that error as well in the "Your First App" lesson, exercises 6, 7, 8...so far.


#3

Kept getting errors on this one.. finally got it to work.

Controller....

app.controller('MainController', ['$scope', function($scope) {
$scope.title = 'This Month\'s Bestsellers';
$scope.promo = 'The most popular books this month.';
$scope.products = [
{
name: 'The Book of Trees',
price: 19,
pubdate: new Date('2014', '03', '08'),
cover: 'img/the-book-of-trees.jpg',
likes: 0,
dislikes: 0
},
{
name: 'Program or be Programmed',
price: 8,
pubdate: new Date('2013', '08', '01'),
cover: 'img/program-or-be-programmed.jpg',
likes: 0,
dislikes: 0
},
{
name: 'Harry Potter & The Prisoner of Azkaban',
price: 11.99,
pubdate: new Date('1999', '07', '08'),
cover: 'http://upload.wikimedia.org/wikipedia/en/b/b4/Harry_Potter_and_the_Prisoner_of_Azkaban_(US_cover).jpg',
likes: 0,
dislikes: 0
},
{
name: 'Ready Player One',
price: 7.99,
pubdate: new Date('2011', '08', '16'),
cover: 'http://upload.wikimedia.org/wikipedia/en/a/a4/Ready_Player_One_cover.jpg',
likes: 0,
dislikes: 0

}

];
$scope.plusOne = function(index) {
$scope.products[index].likes += 1;
}
$scope.minusOne = function(index) {
$scope.products[index].dislikes -=1;
};
}]);

Index......





<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js"></script>





Book End



<div class="main" ng-controller="MainController">
  <div class="container">

    <h1>{{ title }}</h1>
    <h2>{{ promo }}</h2>

    <div ng-repeat="product in products" class="col-md-6">
			<div class="thumbnail"> 
				<img ng-src="{{ product.cover }}"> 
				<p class="title">{{ product.name }}</p> 
			    <p class="price">{{ product.price | currency }}</p> 
			    <p class="date">{{ product.pubdate | date }}</p> 
			    <div class="rating">
			    	<p class="likes" ng-click="plusOne($index)">+ {{ product.likes }} </p>
          <p class="dislikes" ng-click="minusOne($index)">+ {{ product.dislikes }} </p>

			    </div>
			</div> 
			</div>

  </div>
</div>

<div class="footer">
  <div class="container">
    <h2>Available for iPhone and Android.</h2>
    <img src="https://s3.amazonaws.com/codecademy-content/projects/shutterbugg/app-store.png" width="120px" />
    <img src="https://s3.amazonaws.com/codecademy-content/projects/shutterbugg/google-play.png" width="110px" />
  </div>
</div>


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

<!-- Controllers -->
<script src="js/controllers/MainController.js"></script>