From 8ca79aaead7fdc4824cec44688648c7ae8e64a55 Mon Sep 17 00:00:00 2001
From: Matt Mo <matt@montoyatech.com>
Date: Fri, 22 Jan 2021 15:14:37 -0800
Subject: [PATCH] Fixed a few bugs with route matching for router view and
 router links.

---
 ignite-router.js | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ignite-router.js b/ignite-router.js
index 136ce17..6ad1f4e 100644
--- a/ignite-router.js
+++ b/ignite-router.js
@@ -43,13 +43,13 @@ class RouterLink extends IgniteElement {
     }
 
     update() {
-        var routeMatches = true;
+        var routeMatches = false;
 
         //Check the target first.
         routeMatches = RouteMatcher.matches(this.target);
 
         //Check optional routes next.
-        for (var i = 0; i < this.routes.length && routeMatches; i++) {
+        for (var i = 0; i < this.routes.length && !routeMatches; i++) {
             routeMatches = RouteMatcher.matches(this.routes[i]);
         }
 
@@ -101,12 +101,14 @@ class RouterView extends IgniteElement {
     }
 
     update() {
-        var routeMatches = true;
+        var routeMatches = false;
 
-        for (var i = 0; i < this.routes.length && routeMatches; i++) {
+        //Check all of the possible routes until we find a match.
+        for (var i = 0; i < this.routes.length && !routeMatches; i++) {
             routeMatches = RouteMatcher.matches(this.routes[i]);
         }
 
+        //If we found a match show this router view if it's not already visible, otherwise hide it.
         if (routeMatches && !this.show) {
             this.show = true;
         } else if (!routeMatches && this.show) {