Hello,
I am not able to get Dynamic pages working in UDash. Here is the script:
Import-Module UniversalDashboard
Get-UDDashboard | Stop-UDDashboard
if (Test-Path variable:global:psISE)
{
$ScriptDir = Read-Host “ISE detected. Please enter script directory.”
}
else {
$ScriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
}
$Init = New-UDEndpointInitialization -Variable “$Scriptdir”
$Dynamic = New-UDPage -Url “/dynamic/:Name” -Endpoint {
param($Name)
New-UDCard -Title "Welcome to a DynamicPage, $Name!" -Text "This Dynamic Page seems to be working"
}
$TestDash_1 = New-UDDashboard -Title “Dynamic Pages Test” -Content {
New-UDInput -Title "What is your Name?" -Endpoint {
param($Name)
New-UDInputAction -RedirectUrl "/dynamic/name"
}
} -EndpointInitialization $Init
Start-UDDashboard -Port 1001 -Dashboard $TestDash_1 -AutoReload
As you can see, I basically copied an example I found online. When I run the script, I do not get any error messages. When I browse to the dashboard (tried with both Chrome and IE), I enter some text in the input field and click the submit button. The New-UDInput works because it posts the text to a text file in the script directory After that, I am still looking at the home page, so the redirection has not taken place and no new page has been built. Not sure what I am doing wrong, but it feels like the problem is with the Url and hoe I am creating/referencing it. The Udash version is 2.2.1
Thanks
L