Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Is it possible to reload a partial view? #9086

Closed
ShobhitMaheshwari opened this issue Sep 15, 2014 · 2 comments
Closed

Is it possible to reload a partial view? #9086

ShobhitMaheshwari opened this issue Sep 15, 2014 · 2 comments

Comments

@ShobhitMaheshwari
Copy link

As shown in this plunker http://plnkr.co/edit/SWFgpp6ju07IwFB4XLB9?p=preview, if you preview on a separate window, if you click links the partial view is rendered and the url changes, however if the page is refreshed the page shows not found error.

I'm using ngRoute module for routing. This example is in official docs at https://docs.angularjs.org/api/ngRoute/service/$route

I've uploaded the image showing the problem.
Original view
capture3
After clicking a link
capture
After reloading
capture1

@gkalpak
Copy link
Member

gkalpak commented Sep 15, 2014

@RoneyIsland:
In order for html5Mode to work properly, the server-side needs also to be appropriately configured (and you obviously can't configure the plunkr backend).

If you want "deep-linking" to work without server-side configuration (i.e. in plunkr as well), you need to use the traditional hashbang mode.

I.e.:

  1. Remove the line: $locationProvider.html5Mode(true);
  2. Prefix the links' href attributes with #/: E.g. instead of href="Book/Moby" use href="#/Book/Moby"

Working demo

This comment in the docs seems somewhat misleading:

// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);

Do you think it should be removed (@Narretz or @anyone) ?

@petebacondarwin
Copy link
Contributor

@gkalpak - you are exactly right here. I think we should remove this comment. It was added a looonggg time ago in Feb 2012: b49ddf9

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Sep 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants