question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

/area/:id doens't work

See original GitHub issue

I´m trying to use the url path parameter, but in all cases that i have a variable in the parameter Navigo doesn’t recognize the url, and doesn’t do the route. So Navigo always choose the default mapping. The navigate method works, but when i hit the url in the browser it doesn’t.

let router = new Navigo();
    router.on({

            "/area/:id": function (params) {
                   mountPage(params.id);
            },
     });
        router.on(function () {
            console.log("default")
            mountDefault();
        });

    router.resolve();

The url that i´m trying is: http://localhost:8080/area/fin

I´ve tryed without the port number, but same result

The version that i´m using is the master, but i tryed the: https://cdn.jsdelivr.net/npm/navigo@6.0.0/lib/navigo.min.js

With last firefox and crhome presenting the same behavior

Just found out that if i hit this url: http://localhost:8080/area/:id Navigo finds the right mapping …

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
krasimircommented, Dec 6, 2017

That’s because people (including me) use Navigo in a nested URL like http://site.com/myproduct/app/ and the root for the router should be http://site.com/myproduct/app not http://site.com.

1reaction
krasimircommented, Dec 5, 2017

Just update the README and now contains this:

The constructor of the library accepts three argument - root, useHash and hash. The first one is the main URL of your application. If you call the constructor without parameters then Navigo figures out the root URL based on your routes. However, this proves to lead to bugs so I strongly recommend to set a root value.

The thing is that this guessing bit doesn’t work if you have just a few routes. We can’t just pick the current one because you may visit the page within a nested URL. So the root must be set in order to get Navigo working properly. In the future version this will be a mandatory parameter and you’ll simply see an error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure DevOps: Rule with Area ID not working - Stack Overflow
I have created a rule that makes a field mandatory if the area ID is 12. However, the rule doesn't work. Nothing happens....
Read more >
If Face ID isn't working on your iPhone or iPad Pro
By default, Face ID doesn't work if anything is covering your mouth and nose. If you're wearing a face mask and have already...
Read more >
Error Messages | Maps JavaScript API - Google Developers
The Premium Plan or Maps APIs for Work client ID included in the script load is ... The client parameter doesn't seem to...
Read more >
home button works but touch id doesn't work - iPhone 6s - iFixit
I want to make it clear before i began is NO I DID NOT REPLACE THE HOME BUTTON , home button is still...
Read more >
Common questions about the Microsoft Authenticator app
A: Users can send logs to customer support and get the Incident ID with these steps: Open Microsoft Authenticator. Tap Send feedback in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found