- Adding a new
state
property that referenceswindow.history.state
in the router's lifecycle events.
- Adding
hashbang
mode in addition to the existingauto
,hash
, andpushstate
. - Fixed URL change bug when only changing the hash.
- Adding ability to bundle templates and select by ID
<app-route path="/home" import="pages/bundled-templates.html" template="homepage"></app-route>
. - Adding
async
flag to<app-route>
HTML imports. By default HTML imports block rendering of the page. The router waits for the link'sload
event to fire before using the imported document so this will speed up rendering when navigating between routes.
- Adding
onUrlChange="reload|updateModel|noop"
attribute to<app-route>
. This is useful when you have nested routers and you only want to change the inner most route.
- Fixing bug where navigating multiple times before any page finishes importing will lose the reference to the currently loaded route (
previousRoute
) before it is removed from the DOM. - Adding
route.importLink
reference.
- Fixed bug where navigating to the same link twice with
core-animated-pages
would remove the page after 5 seconds.
- Adding globstar
**
support. - Adding relative paths
users/:userId
which is the same as/**/users/:userId
.
- Fixed bug where calling
router.go('/path')
on the current path wouldn't reload the page. - Switched
router.go('/path')
to fire apopstate
event instead of directly callingstateChange()
in order to support multiple routers on the same page.
- Fixing bug where
router.go('/path')
would replace state instead of push state.
- Adding
typecast="auto|string"
option on theapp-router
. Path variables and query parameters are typecast to numbers, booleans, and unescaped strings by default. Now you can get the raw string withtypecast="string"
. - Optimized hash fragment changes so that if only the hash fragment changes it will scroll to the fragment and not reload the entire page.
- Fixing bug where the
before-data-binding
event wasn't using the updated model if the entire model was replaced.
- Added ability to scroll to hash fragment on navigation. For example,
http://example.com/#/page1#middle
will now scroll to an element withid="middle"
orname="middle"
.
- Added data binding to
<template>
tags when Polymer (TemplateBinding.js
) is present. - Added
bindRouter
attribute to pass the router to theapp-route
's page. - Added
before-data-binding
event to add properties to a model before it's bound to the route's custom element or template. - Fixed a
core-animated-pages
bug where multiple URLs matched the sameapp-route
(ex:path="/page/:num"
and paths/page/1
,/page/2
).
- The move from
platform.js
towebcomponents.js
removed theURL()
constructor polyfill. The v2.0.3 fix created a bug in Safari when parsing the URL. This fixes Safari.
- The move from
platform.js
towebcomponents.js
removed theURL()
constructor polyfill webcomponents/webcomponentsjs#53. IE doesn't support theURL()
constructor yet so this fix is adding URL parse support for IE.
- Fixing issue 19 using best effort approach. Use
template.createInstance()
if Polymer is loaded, otherwise usedocument.importNode()
.
- Fixing bug where multiple
<app-route>
s had anactive
attribute.
New features
- Added support for
<core-animated-pages>
. Example: set up the router like<app-router core-animated-pages transitions="hero-transition cross-fade">
then include thehero
andcross-fade
attributes on the elements you want transitioned.
Breaking changes
- Previously the active route's content was under an
<active-route>
element. Now the content for the route is under it's<app-route>
element. This changed to support<core-animated-pages>
. - The
<active-route>
element androuter.activeRouteContent
have been removed. - Removed the
shadow
attribute from the<app-router>
. This was applied to the<active-route>
element which no longer exists.
Breaking changes
pathType="auto|hash|regular"
has been replaced withmode="auto|hash|pushstate"
for redirects,router.go(path, options)
, and testing routes.
New features
- Added support for redirects with
<app-route path="..." redirect="/other/path"></app-route>
. - Added
router.go(path, options)
. Example:document.querySelector('app-router').go('/home', {replace: true})
. - Note: If you're using redirects or
go()
you should specify the mode with<app-router mode="pushstate|hash"></app-router>
. Leaving the mode asauto
(the default) will change the hash, even if you wanted it to change the real path with pushstate.
- Refactor
parseUrl()
to use the nativeURL()
constructor and return additional information about the hash path. - Cleaned up
testRoute()
androuteArguments()
with additional information fromparseUrl()
. - Moved utility functions to
AppRouter.util
.
- Fixed bug where the regular path was being used when
pathType="hash"
was set on the router.
template
no longer required on inline template routes.- Only use
app-route
s that are direct children of the router by replacingquerySelector()
withfirstElementChild
and iterating withnextSibling
. - Took internal functions off the public API and simplified parameters.
- Added the
pathType
attribute to the router. The options areauto
,hash
, andregular
.