Skip to content

E0340: A path parameter the page doesn't have ​

A component's field marked with a bare @ui.URL, no name, binds the route's path parameter of the field's name: id int64 @ui.URL reads {id} from pages/orders/[id].vuka.html. A page whose markup renders the component must have that parameter in its path, or the field could never be filled. vuka checks each folder page's markup when it builds the route table, and names the page's parameters, suggesting the closest.

Wrong ​

html
<!-- components/order.vuka.html -->
<script lang="go">
package components

import "github.com/vuka-lang/ui/v2"

type Order struct {
	ui.Live
	id int64 @ui.URL
}
</script>

<p>Order {id}</p>
html
<!-- pages/orders/index.vuka.html: its path is /orders, with no {id} -->
<components.Order />
html
<!-- pages/orders/[id].vuka.html: its path is /orders/{id} -->
<components.Order />

Or keep the value in the query instead, id int64 @ui.URL("id"), which any page can carry.

Released under the MIT License. Vuka builds on Go and its tools, which are made by the Go Authors. Vuka is not affiliated with Google or the Go project. Go is a trademark of Google LLC.