Routing with subdirectories


#1

My template wont show. I am using angular and express.

With express i have a route in routes.js:

`router.get('/dashboard*', isLoggedIn, function(req, res){
	res.sendfile('./public/views/dashboard/dashboard.html');
});`

So when i enter localhost/dashboard my dashboard.html is showing.
dashboard.html:

<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/ngRouter.js"></script>

<base href="/dashboard">

</head>
<body ng-app="myApp">

<div id="container">
	<div id="content">
        <div ng-view></div>
    </div>
</div>
</body>
</html>

"myApp" is is defined in app.js:

angular.module('myApp', []);

and ngRouter.js:

angular.module('myApp').config(function($routeProvider, $locationProvider) {
$routeProvider.when('/home', {
	templateUrl: 'views/dashboard/dashboardHome.html'
})
.otherwise({
	redirectTo: '/home'
});

$locationProvider.html5Mode(true);
});

The folder hierarchy:

  • app
    • routes.js
  • public
    • js
      • app.js
      • ngRouter.js
    • views
      • dashboard
        • dashboard.html
        • dashboardHome.html

I cant find my problem, ive looked at documentation and searched google


#2

Help me understand something here... Is this a codecademy course or one of your projects? So i can give you the best anwser.


#3

This is one of my own projects


#4

Then This place is not a place to ask those types of questions... Ask Stackoverflow instead...