Skip to content
This repository was archived by the owner on Aug 9, 2018. It is now read-only.

Upgrading Angular to 1.3.8 and adding a fix #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/weather/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<html>
<head>
<base href="/">
<title>AngularJS-Server Weather Example</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/:static/style.css">
Expand Down
9 changes: 9 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ function makeHtmlGenerator(serverScripts, prepContext, clientScripts, template,
var path = reqContext.location.path();
var search = reqContext.location.search();

//Fixing trailing slash issue - when navigating from home to any city (ex: boston) and reload the page, somehow '\' is added to the end of location.href, which breaks the routing.
//This code will remove the trailing slash
//Taken from https://github.com/angular-ui/ui-router/issues/50#issuecomment-64895625
var re = /(.+)(\/+)(\?.*)?$/
if(re.test(path)) {
path = path.replace(re, '$1$3')
}
//End of fix

var matchedRoute = $route.getByPath(path, search);

if (matchedRoute) {
Expand Down