#1579 prevent infinite loop in non-existent default route

This commit is contained in:
Leo 2017-02-03 22:21:14 -05:00
parent 5faa996805
commit 9d5f686bbd
5 changed files with 51 additions and 52 deletions

View file

@ -14,8 +14,9 @@ module.exports = function($window, redrawService) {
var run = function() {
if (render != null) redrawService.render(root, render(Vnode(component, attrs.key, attrs)))
}
var bail = function() {
routeService.setPath(defaultRoute, null, {replace: true})
var bail = function(path) {
if (path !== defaultRoute) routeService.setPath(defaultRoute, null, {replace: true})
else throw new Error("Could not resolve default route " + defaultRoute)
}
routeService.defineRoutes(routes, function(payload, params, path) {
var update = lastUpdate = function(routeResolver, comp) {