I am building up a single page website using MEAN, I've tried multiple tutorials and googled a lot of examples but i cant seem to get it working.
i am using angular-routing
for my templates, but when I add a controller - the templates is not showing. Not any error.
app.js
angular.module('sampleApp', ['frontPageCtrl','ngRoute', 'appRoutes']);
appRoutes.js
angular.module('appRoutes', [])
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/home.html',
controller: 'frontController'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode(true);
}]);
frontPageController.js
angular.module('frontPageCtrl', [])
.controller('frontController', function($scope, $http) {
});
In my index.html
file I have included all three files with app.js
first and after angular include.
EDIT:
This is my index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="/">
<link rel="stylesheet" href="libs/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="libs/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="css/frontPage.css">
<link rel="stylesheet" href="libs/bootstrap/"
<!-- JS -->
<script src="libs/angular/angular.min.js"></script>
<script src="libs/angular-route/angular-route.min.js"></script>
<script src="js/app.js"></script>
<script src="js/appRoutes.js"></script>
<script src="js/controllers/frontPageController.js"></script>
</head>
<body ng-app="sampleApp" ng-controller="frontController">
<div id="container">
<div id="content">
<div ng-view></div>
</div>
</div>
</body>
</html>
Things to check
And don't forget to mark it as an answer if this answers ur question :)