0

I am developing asp.net mvc project with angularjs routing. Indroducing some routing errors while reloading page. In my application,

    .when('/home', {
        templateUrl: '/Selection_Routing/Selection_Product/Home.html',
        controller: 'HomeController'
    })

This page works fine if I reload page. But, If I reload the next page it shows Server Error in '/' Application. HTTP: 404 error.

.when('/computer', {
        templateUrl: '/Selection_Routing/Selection_Product/Laptop.html',
        controller: 'LaptopController'
    })

I appreciate for the answer.

4
  • probably that old answer can help you "http://stackoverflow.com/questions/20307655/404-error-with-angularjs-templateurl-routing" Commented May 18, 2016 at 21:06
  • html5Mode is true? Commented May 18, 2016 at 21:19
  • if you are using Html5Mode your server needs to be configured as well as angular. What server technology are you using? The folks that wrote UI-Router also wrote a very good FAQ that talks about this and gives configuration options for many popular servers: github.com/angular-ui/ui-router/wiki/… Commented May 18, 2016 at 21:54
  • I am using IIS...I'll try UI-Router also.. Commented May 18, 2016 at 23:02

1 Answer 1

0

Maybe this can help "stackoverflow.com/questions/16569841/reloading-the-page-gives-wrong-get-request-with-angularjs-html5-mode"

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

5 Comments

Edited answer. If you have html5mode enabled that question should help you.
$locationProvider.html5Mode(true).hashPrefix('!'); Doesn't work
Remove that .hashPrefix() and on the server side create a .htaccess file inside your root folder and paste this: RewriteEngine On Options FollowSymLinks RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /#/$1 [L]
I have created a .htaccess file where web.config/setup file located...But still it doesn't work.
Ok I just saw you are using ISS , what I told your is for Apache. Claies commented on your answer with a link to how to do this for ISS. Try that.

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.