Output is empty


#1

I am getting blank output. Please help me to sort out this error.
index.html

Suggestion Box
</head>
<body ng-app="SuggestionBox" ng-controller="HomeController" >
<h1 id="title"><span><img id="bulb" src="images/light-bulb.png"></span>Suggestion Box</h1>
<div ng-view></div>

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

<!-- Controllers -->
<script type="text/javascript" src="js/controllers/HomeControllers.js"></script>
<script type="text/javascript" src="js/controllers/SuggestionControllers.js"></script>
<!-- Services -->
<script type="text/javascript" src="js/services/suggestions.js"></script>
home.html
    <h3>{{ post.title }}<button id="remove"><span class="glyphicon glyphicon-remove-sign" ng-click="remove($index)"></span></button></h3>
    <p>
        <button id="add"><span class="glyphicon glyphicon-plus-sign" ng-click="upVote(post)"></span></button> Upvotes: {{post.upvotes}}
    </p>
    <a class="link" href="/#!/suggestion/{{$index}}">Comments</a>

</div>

<div class="operation">
    <form ng-submit="addSuggestion()" style="margin-top: 50px">
        <h3> Submit Your Suggestion </h3>
        <div class="form-group">
            <input type="text" class="form-control" placeholder="Great ideas here" ng-model="title"></input>
        </div>
        <button type="submit" class="btn btn-primary">Suggest</button>
    </form>
</div>
suggestion.html

{{ post.title }}

Upvotes: {{post.upvotes}}

Comments:


  • {{ comment.body }}
  • Upvotes: {{comment.upvotes}}

Submit Your Comments

Comment
HomeControllers.js app.controller('HomeController', ['$scope', 'suggestions', function($scope, suggestions) {
$scope.posts = suggestions.posts;

$scope.addSuggestion = function(){
    //if input empty, don't submit
    if(!$scope.title || $scope.title === ''){
        return;
    }

    //push suggestion posts in suggestions.js
    suggestions.posts.push({
        title: $scope.title,
        upvotes: 0,
        comments:[],
    });

    //after submit, clear input
    $scope.title = '';
};
$scope.remove = function($index){
    $scope.posts.splice($index, 1);
};
$scope.upVote = function(post){
    post.upvotes += 1;
};

}]);
SuggestionControllers.js
app.controller(‘suggestionController’, [’$scope’, ‘$routeParams’,
‘suggestions’, function($scope, $routeParams, suggestions) {

$scope.post = suggestions.posts[$routeParams.id];
$scope.addComment = function(){
    if(!$scope.my_comments || $scope.my_comments === '' ){
        return;
    }
    $scope.post.comments.push({
        body:$scope.my_comments,
        upvotes:0,
    });
    $scope.my_comments = '';
};
$scope.remove = function($index){
    $scope.post.comments.splice($index, 1);
};
$scope.upvoteComments = function(comment){
    comment.upvotes += 1;
};

}]);