Binding functions with attributes
Is there a way to bind functions to attributes, something like this:
<a _href="{{go('login')}}">Login</a>
then
String go(String routePath) {
// Returns url for login
}
+3
Miguel Fermin
source
to share
1 answer
For a routing task, you can bind using an additional attribute for the path:
<a route="/api/login" on-tap="{{go}}">
and then in your go function:
void go(Event e, var detail, Element sender) {
e.preventDefault();
fire('change-route', detail: sender.attributes['route'] );
}
+3
Mike
source
to share