0
votes

I have made changes in my index.html and app.js.

This is app.js file.

angular
        .module('assessmentApp', ['ngRoute', 'ngCookies', 'ngSanitize', 'timer', 'assets', 'youtube-embed'])
        .config(config)
        .run(run);

    config.$inject = ['$routeProvider', '$locationProvider', '$httpProvider'];

    function config($routeProvider, $locationProvider, $httpProvider) {
        /*$locationProvider.html5Mode({
          enabled: true,
          requireBase: false
        });*/
        $routeProvider
            .when('/', {
                templateUrl: 'views/home.html',
                controller: 'HomeController',
                controllerAs: 'vm'
            })
            .when('/login', {
                templateUrl: 'views/login.html',
                controller: 'LoginController',
                controllerAs: 'vm'
            })
        if(window.history && window.history.pushState){
                $locationProvider.html5Mode({
                    enabled: true,
                    requireBase: true,
                    rewriteLinks: true
                });
            }
    }

This is Index.html.

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>Assessment</title>
    <meta name="description" content="">
    <meta http-equiv=X-UA-Compatible content="IE=edge">
    <meta name=viewport content="width=device-width,initial-scale=1">
    <base href="/assessment/"></base>
</head>
</html>
  1. I have followed all the solution which is present related to my problem but still my app not working.
  2. I am using nginx server but I don't know is any changes requied or not? If yes then what change?
  3. I added html5 api and base tag and i removed all # from my app html file so my app is working fine but when I am going to reload my application it return page not found
1
What does # have to do with your HTML file? - Daniel Vestøl
Before in my all html file had # with location like <a href="#/somelocation" class="alert-link">.But now i made change to <a href="somelocation" class="alert-link">. So working fine until i am not reloading page. So give me solution for when I will reload page it should not give page not found error - user5506608

1 Answers

0
votes

Make sure your server is set so that it is returning your index.html instead of a 404. In your nginx config for this site add:

error_page 404 =200 /index.html;

Alternatively, you can redirect like this:

try_files $uri $uri/ /index.html;