0

Index Page :

  <ng-view></ng-view>

Angular Controller :

    when('/', {
        url: '/',
        templateUrl: 'site/home',
        controller: 'indexController'
    }).

    when('/site/help', {
        templateUrl: 'site/help',
        controller: 'indexController'
    }).

Help Page Content :

Some help Content

The Problem is when I navigate from Index page by using /site/help link it shows me help page content with menu of index page.

But when I reload the page it only shows help page content without any styles or javascripts loaded.

4
  • Home page like this : <base href="/"> <script src="~/Scripts/angular.min.js"></script> <script src="~/Scripts/angular-route.min.js"></script> <script src="~/Scripts/angular-animate.min.js"></script> <ng-view></ng-view> Commented Sep 10, 2017 at 9:44
  • You have to redirect all subpages to index.html. Commented Sep 10, 2017 at 14:55
  • Looks like you are using HTML5Mode. Please refer this URL. docs.angularjs.org/guide/$location Either turn of html5mode or add an internal redirect to home page if the page is not retrieved via xhr (Look for headers) Commented Sep 10, 2017 at 14:57
  • It is working but how can I achieve the same with html5 mode as true? Any help will be appreciated. Thanks in advance. Commented Sep 10, 2017 at 16:10

1 Answer 1

1

You should put ng-view tag in index.html, because this page is the main page and the other pages are part of that:

<body> 
    //some content
    <ng-view></ng-view> 
</body>
Sign up to request clarification or add additional context in comments.

3 Comments

<html> <head > <title></title> <base href="/"> </head> <body> //Navigation menu with anchor tags <ng-view></ng-view> </body> </html> Already I have used this structure.But still when partial view gets refreshed it only shows partial view content without any style, scripts loaded and no menu of index.html page
I'm developing the application in Angularjs with ASP MVC as back end. Do I need to modify RoutesConfig or something else?
$locationProvider.html5Mode(true).hashPrefix('!'); used in angular route config also

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.