Comments not working


#1

Hi there, I am on the last step and now that I have tried to integrate my comments and suggestion.html my whole screen is blank..?

repository


#2

Heyyo, looks like you haven't properly defined SuggestionContoller.js - currently it is identical to app.js


#3

suggestioncontroller.js

app.controller('SuggestionController', ['$scope', '$routeParams', 'suggestions', function($scope, $routeParams, suggestions) {
	$scope.post = suggestions.posts[$routeParams.id].comments;

	//add comments
	$scope.addComment = function() {
		//check if input is empty
		if(!$scope.comment || $scope.comment === ""){
				return;
		}
		$scope.comments.push({
			body: $scope.comment,
			upvotes: 0
		});

		//clear submit input after submitted
		$scope.comment = '';

	}

	$scope.upVote = function(comment){
    	comment.upvotes += 1;  
    };

}]);

app.js

var app = angular.module('SuggestionBox', ['ngRoute']);
app.config(function ($routeProvider){
    $routeProvider
    .when('/',{
        controller: 'HomeController',
        templateUrl: 'views/home.html'
    })
    .when('/suggestion/:id', {
        controller: 'SuggestionController',
        templateUrl: 'views/suggestion.html'
    })
    .otherwise({
        redirectTo: '/'
    });
});

#4

This statement doesn't look right. Why do you have .comments in the end?