How come I can't navigate to a page using a regular url? For example I have a page at /about, but if I open a new tab and try to go to http://localhost:3000/about I'll get the general Cannot GET '/about' error.
But if I go to http://localhost:3000/#!/about it renders the page and changes the url to a clean url without the #!.
I have html5Mode(true) set.
I'm using version 1.6.6 of angular and angular-route
Related
I have an Ember app which is run using engines (So there are other apps as well)
In my app, I have the following route defined in addon\routes.js
this.route('my-route');
My question is, say from some other app (which does not use Ember), can I have the following link called as say href of an anchor tag
OR browser redirect & it would deep route to where I want ?
https://abc.xyz.com/xyz/123/ui/#/myapp/my-route?action=123
I ultimately hope to get the control in my-route (after the other app hits the above URL)
I am using angularjs routing in my web app, and I have included the $locationProvider and the base tag in HTML head which is <base href="/webapp/"> in order to remove the hash symbol in the URL, it works fine when I redirect using anchor tags e.g. Home but gives a 404 error when I redirect using javascript e.g. window.location.href = '/webapp/home';. Tried everything but so far nothing, any help will be highly appreciated. Thank you in advance.
Try : Home
When you are using angular(JavaScript) routing; JavaScript routing start after # keyword in URL, other wise browser think this is the server side routing trigger; or page will get refresh.
USE : Home
$locationProvider will remove the # after redirecting to the the view.
I've created a small website by using backbone.js. It's hosted in IIS 7.
The routing:
routes: {
"/": "index",
"": "index",
"detailedpage/:id": "detailedpage",
'*notFound': 'index'
}
I've a problem when I try to copy/paste an url.
If I want to access directly to
http://www.anydomain.com/detailedpage/1234
it's not working. I can see in the developper tools an internal server error for 1234, path "/detailedpage".
The strange thing is if I access first to
http://www.anydomain.com/
and after copy/paste the url
http://www.anydomain.com/detailedpage/1234
it's working.
Can you please tell me if I need to enable/disable any handler in IIS?
Thank you!
Since backbone is doing the routing, your browser has to have the right content before its loaded. If you wish to use pushState with Backbone, you have to trick your webserver into serving the same html page for all possible routes. The way we do that in IIS is have the .NET routing setup in such a way that loads the required backbone assets so it can do routing directly.
Alternatively, you can disable pushState in Backbone.history.start() and use hash based routing. (myurl/#/myroute)
These are client routes, so you begin with a #.
http://www.anydomain.com/#detailedpage/1234
Include a hashtag is not a solution. It's just tell to the browser what is the root url.
The root cause is probably the redirection to the index page which is not correctly working.
The solution I did is to put the html into a view in a MVC application. All requests are redirect to the same controller, which return this new view. So I'm sure that all request are redirect to the index page.
I have AngularJS setup to use HTML5 routes and it works great on urls like website.com/foo but when I create routes for sub pages, eg: website.com/foo/bar it only shows the correct page when clicking a link to it on my site. If I type the url into my browser and attempt to directly access it I get a blank page section where the ng-view content should be loading.
app.when('/promotion/events', {
templateUrl: '/assets/tpl/promotion/events/home.html',
controller: PromotionEventsCtrl
});
It appears to be a bug in Angular 1.1.5 that is effecting URL parsing in HTML5 routes. Rolling back to 1.1.4 fixes the problem.
More information here: https://github.com/angular/angular.js/issues/2833
When users send app requests, the requests point to the canvas page instead of the page tab.
I know the solution is to point your Canvas App URL to a page that redirects to the page tab. However, it's not working.
This is the JS on my redirect page:
top.location.replace("#{PAGE_TAB_URL}");
Going to the redirect page directly (myapp.com/redirect) will redirect to the page tab fine. But for some reason, requests don't work. When users click to view the request, my app returns a 404.
Is there some problem with top.location.replace within Facebook?
The following question's solution did not work for me: FB app request points to canvas page instead of page tab
The problem was in my routes file (it's a Rails app), I was only geting /redirect, and wasn't handling post, which is what happens in a page tab. Working solution:
On redirect page:
`window.top.location.href = "#{PAGE_TAB_URL}";`
routes.rb:
`match "redirect" => "home#redirect"`