I cant get open the route "/d" but "/" is working. What could be the problem? I tried different things but id did not find a solution.
var myApp = angular.module('myApp',['ngRoute']);
myApp.config(function ($routeProvider) {
$routeProvider.when('/', {
controller: 'OrdersController',
templateUrl: 'views/lp.html'
})
.when('/d',{
controller:'OrdersController',
templateUrl: 'views/order_detail.html'
})
.otherwise({
redirectTo: '/'
});
});
Server side code looks like this. Maybe they dont like each other ;)
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var mongoose = require('mongoose');
app.use(express.static(__dirname+'/client'));
app.use(bodyParser.json());
Order = require('./models/order.js');
//Connect to Mongoose
mongoose.connect('mongodb://localhost/groundlevel');
var db = mongoose.connection;
app.get('/', function(req, res){
res.send('Please use /api/order');
});
app.get('/api/orders', function (req, res) {
Order.getOrders(function (err, orders) {
if(err){
throw err;
}
res.json(orders);
})
});
app.get('/api/orders/:_id',function (req, res) {
Order.getOrderById(req.params._id, function (err, order) {
if(err){
throw err;
}
res.json(order);
})
});
app.post('/api/orders', function (req, res) {
var order = req.body;
Order.addOrder(order, function (err, order) {
if(err){
throw err;
}
res.json(order);
})
});
app.listen(3000);
console.log('Running on Port 3000...');