Navigate-to-parameters not working


#1

Hi,

I want to navigate from a calendar-control to another page.
This works, the problem is if I want to add a parameter the app crashes (which name/value it has does not change the error-message).


The error message in the browser-console is "ERROR Error: "Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'events'"

Some facts which could impact the problem (I am guessing here):
-we really have an "Event" table in our database (I generated crud-pages for it)
-I am navigating from the calendar-select-event to the generated events-list, not to the add- or edit-dialog

I found a similiar discussion here: Manage page url parameters
But it is not clear to me if I need to create some routing on my own or add the parameter in another way (it needs to be optional, and it isn't).


#2

Hi @Moo,

The correct value should be ${event.YourProperty} however the intellisense adds ${event.id}. We will fix this immediately! Can you check using the debugger what properties you have?

Best Regards,
Vladimir


#3

That is good to hear, thank you. But it has nothing to do with my problem. I can not send optional parameters while using the "Navigate to page" property.

My current workaround is:
"Execute code"

window.location.href = "/events?EventID="+${event.EventID}

Read that query-parameter on the events-page in the Load-event:
"Execute code"

function getParameterByName(name, url=null) {
if (!url) url = window.location.href;
name = name.replace(/[[]]/g, '\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/+/g, ' '));
}

Next step:
"Set property" parameterEventID

${getParameterByName('EventID') ? getParameterByName('EventID') : ""}


#4

To answer you question about the intellisense properties:
It seems to generate a list of control-properties
image
(I do not think I can look that up in the debugger, the whole app crashes if try to configure a parameter, because of the routing-issue)


#5

I see. Possible solution is to add client/src/app/app.routes.ts to application ignore list and add additional route without parameter. For example:

We will do our best to find a way to support this.


#6

That sounds like a much better workaround than the one I scribbled together.
But where is this application ignore list?
I suppose this ignore list blocks the app.routes.ts from getting regenerated by radzen?


#7

Yep, more info can be found here:

You need however to be careful with this since if you add new page the new route will not be added.


#8

Here is another way without ignore list: