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
Add ability to call into view model from script / dynamic elements #426
Comments
You can walk the HTML node tree and look for nodes that have an |
I was able to get it to work somewhat with a similar approach but there were context issues ('this' was not the view model). Lets look at a different approach, I found this example you wrote in another issue (aurelia/templating#35) and modified it based on the latest changes. It works fine for ${item.Name} but the button click delegate doesn't work. ViewModel:
Compiler:
The DOM does appear to get marked up properly: Thanks!
|
I guess You'll need to pass the context (value for |
There are times when I want to deal with ajax/json data and render it on the client.
A good example of this is using DataTables with a ajax data source.
it would be nice if there was a way to call into the view model to perform actions such as showing editors, calling service clients and other operations from the client code.
In my example of DataTables, the rows/columns and buttons are client generated and therefore do not go through the template/view render.
Is there a var similar to $parent that would resolve client side to point to the view model of the current route view/module?
Here's a sample of what I'm referring to.
After a couple days of searching, I have found no documented way of performing this action.
In the sample above, I'd like to be able to generate the button string client side via DataTables but call the showEditor method on the view model.
If there as a more appropriate way of achieving this, let me know and I'll close the issue.
The text was updated successfully, but these errors were encountered: