2

Let me start off by saying my apologies for the formatting. I'm posting from a mobile phone.

In my /public/js/app.js I have this

var app = angular.module("myApp", ["ngRoute"]);
app.config(function($routeProvider) {
    $routeProvider
    .when("/", {
        templateUrl : "/public/views/index.html"
    })
    .when("/packages", {
        templateUrl : "/public/views/packages.html"
    })
    .when("/contactus", {
        templateUrl : "/public/views/contactus.html"
    })
    .when("/signup", {
        templateUrl : "/public/views/signup.html"
    })
. otherwise({
redirectTo: "/";
});
});

And in my /public/index.html

I have this below

<html ng-App="myApp">
// All the angular script files including app.js
<body>
<div ng-view></div>

All my HTML files are located at /public/views/

I get the "cannot GET '/contactus'"

Or any webpage for that matter that's not the index.

Any help?

2
  • In your browser, are you going to the URL '/contactus' or the URL '/#/contactus'? You probably need to use the latter. Commented Jan 13, 2017 at 1:23
  • I'm going to /contactus in my browser Commented Jan 13, 2017 at 1:27

1 Answer 1

0

It should be all lowercase ng-app and you have ; on otherwise object. Can you try with that.

Sign up to request clarification or add additional context in comments.

1 Comment

As you have mentioned above comment, if you want to remove # tag then you need to have $locationProvider.html5Mode(true). Your code will look something like this. app.config(function($routeProvider, $locationProvider) { //your route path $locationProvider.html5Mode(true); }); and in head tag <head> <base href="/"> </head>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.