Hi gyus, I am working on Final Project Suggestion Box of AngularJS and there is an error that I am unable to resolve .Kindly have a look at it and help me to get over this error
angular.min.js:7 Uncaught Error: [$injector:modulerr] which is mainly due to angular.min.js file which I uploaded from there site.
index.html:
<!> DOCTYPE html>
<html> <head>
<title>Suggestion Box</title> </head> <body ng-app="SuggestionBox" > <div ng-view></div> <!-- Modules -->
<!-- Controllers -->
<!-- Services -->
</body> </html>
app.js
var app = angular.module(‘SuggestionBox’,[‘ngRoute’]);
app.config(function($routeProvider){$routeProvider.when(’/’,{
controller:‘HomeController’,
templateUrl:‘C:/ANGULARJS_PROJECT/suggestion_box/views/home.html’
})
.when(’/’,{
controller:‘SuggestionController’,
templateUrl:‘C:/ANGULARJS_PROJECT/suggestion_box/views/suggestion.html’
})otherwise({
redirectTo: ‘/’
});
});
suggestions.js
app.factory(‘suggestions’, [function(){
var demoSuggestions = {
posts: [
{
title: ‘Sing Bon Jovi s “Living on a Prayer” halfway through meetings’,
upvotes: 3,
comments: [],
},
{
title: ‘Free pizza at club meetings’,
upvotes: 15,
comments: [],
},
{
title: ‘End all club emails with Laffy Taffy jokes’,
upvotes: 9,
comments: [],
},
{
title: ‘Retrofit water fountain with Gatorade’,
upvotes: 7,
comments: [],
},
]
};
return demoSuggestions;
}])
HomeController
app.controller(‘HomeController’, [’$scope’,’$routeParams’, ‘suggestions’, function($scope,$routeParams, suggestions) {
$scope.posts = suggestions.posts;
$scope.upVote = function(post){
post.upvotes += 1;
};$scope.addSuggestion = function(){
if(!$scope.title || $scope.title === ""){ return; } $scope.posts.push({ title: $scope.title, upvotes: 0 }); $scope.title = "";
}
}]);
Suggestion Controller
app.controller(‘SuggestionController’, [’$scope’, ‘$routeParams’, ‘suggestions’, function($scope, $routeParams, suggestions) {
$scope.post = suggestions.posts[$routeParams.id];
console.log($routeParams.id);
$scope.addComment = function(){
if(!$scope.new_comment || $scope.new_comment === “”){
return;
}$scope.post.comments.push({ body: $scope.new_comment, upvotes: 0 }); $scope.new_comment = "";
}
$scope.upVoteComment = function(comment){
comment.upvotes += 1;
};$scope.new_comment = “”;
}]);