-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
href as action does not carry over parameters #347
Comments
I think it´s better to store the value in the cache or global apis So you can have the variable in both views |
why is that an advantage? it's more work for the caller to do this and I just don't see any advantage. The value is already available in both views, in the caller because they must have it to put it in the options and, if my suggestion was implemented, it would then also be in the target view. There are issues like pass by reference or by value which might be relevant, but my suggestion there would be to treat the view to view as a function call so the options would would be passed by value. You closed this by saying something unrelated, the variable is available in both views anyway, the issue was how to pass it to another view. There have been others who expected the view to view mechanism to work this way, so it's certainly more intuitive. Using the cache wouldn't work anyway. "Cache and local variables are both sandboxed per view url", so the value would not be visible in the called view. Using global variables would of course, but in 2018, using global variables to pass values between views just seems seriously outdated. |
Please read this https://medium.com/@gliechtenstein/native-mobile-view-as-microservice-fd24ea62defa Here is an example of using {
"type": "$href",
"options": {
"url": "https://jasonbase.com/things/3fj.json",
"options": {
"firstName": "Bart",
"lastName": "Simpson"
}
}
} |
Using only href works, see my initial post. |
@clsource I'm not sure what the blog post you mentioned has to do with this? I also don't really understand the point about sandboxing where views all share a common global dictionary, that's not really how sandboxing works. But regardless you originally closed this issue suggestion people not use the options and instead put their parameters into the $global dictionary, and I responded that that's not a very good user experience. Now you're suggesting that we use the parameter passing mechanism that mexophantes wanted all along. Letting two views manipulate a global variable is a very bad suggestion, it's just bad software engineering. The right way is to follow the traditional stack method, which is what $href does, pass by value (not reference), then return by value (with $ok). The problem is that mexophantes says this does not work with href actions, but does with $href. I haven't tried this to know since I'm passing values around using only $href, but at least now I think we're all in agreement that we shouldn't be communicating between views using $global variables. |
Hello, I am also looking for a solution. I have tried both the action and the link versions without success. I do not think the options are getting passed to the target view via the $params reference. The item triggering the link looks as follows: { I expected to be able to just use: {{$params.name}} This example is right off the website. I tried both versions, action and link. Same results. The expansion of the template expression doesn't happen. I see there isn't really an answer in this thread, but if anyone out there has solved this , I'd like to know how. Thanks |
Added $env.view.params variable that holds the query params inside the url. Example https://example.com?param1=1¶ms2=true. Will show param1 and param2 as properties inside the params dictionary. |
I would like to hand over a parameter (id) from one view to the next when clicking on a button like this:
Both version however don't work:
The version that does work is this one, which is however not usable in my setup, since I would also like to implement the
$ok
two-way communication:The text was updated successfully, but these errors were encountered: