angularnode app ignores routing and doesnt load view into ng view

angularnode app ignores routing and doesnt load view into ng view  using -'javascript,html,angularjs,node.js,routing'

I am developing a Node+Angular application. I am familiar with Angular, but a beginner in Node so I figured it would be a great start. I am not sure if the problem is with Node or with Angular, so I will just post the code here.

My folder hierarchy is:

- public
  - AppAngular
    - controllers
    - models
    - views

In my server.js, I've specified the code below:

app.get('*', function (req, res) {
    res.sendFile(__dirname + '/index.html')

I don't have any API, since the plan is to build a real-time chat with, something I've always wanted to try out.

Anyway, my app.js looks like this:

var app = angular.module('ChatApp', ["ngResource"])

app.config(['$routeProvider', '$locationProvider',
    function ($routeProvider, $locationProvider) {

            .when('/', {
                templateUrl: 'views/chatView.html',
                controller: 'chatController'
                redirectTo: '/'

I have referenced everything in my index.html like this:

<!DOCTYPE html>
<html ng-app="ChatApp" xmlns="">
    <meta charset="utf-8" />

    <script src="/node_modules/angular/angular.js"></script>
    <script src="/node_modules/angular/angular-resource.js"></script>
    <script src="/public/AppAngular/controllers/chatController.js"></script>
    <script src="/public/AppAngular/app.js"></script>

    <script src="/"></script>
        var socket = io();
    <div ng-view></div>

There is no need to post contents of chatView.html and chatController.js since both are straightforward.

Does anyone have the slightest idea to what's the problem? I have a pretty similar config in one of my other projects, with dozens of routes and it works flawlessly but this... Meh. Thank you, in advance.

asked Oct 11, 2015 by patelnikul321
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.