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
Try to bind a variable to t-content? #17
Comments
Tested variables inside of the element content works fine by the way. I bind the view() to the parent of the remote template and the firstname variable is filled as should. Looks like t-content not supports variables? |
@pwFoo Change the content of the ` This message area was loaded remotely by remote_template.html. You should see the first name twice.
${firstname}
|
Strange. In my test it doesn't work with a second "model", firstname works for me too.
template
First and third line works as should, Second is empty? |
myvar works in main html file in that line as should!
|
another example based on issue6.html (nodelist test).
Added a |
@pwFoo Acknowledging your issue. It will take a day or so to get to this. |
@pwFoo This code works. Your example did not work because you were trying to replace variables in the body element with model2 data and variables using model inside a nested remote template inside an element contained in body.
|
Hi @anywhichway, the html code of your example isn't displayed as source I think? Could you edit your post to show the html full source which should work? So nested models down't work? Or remote template (elements) inside of a model? Another question about multiple models and performance. |
@pwFoo Nested remote templates don't work. Never tested it. Will review code to see if it is possible to get working. Better to use one model. Updates are only driven by the changes to specific properties on the model, so no more overhead than multiple models and easier to manage. That being said, if the domain warrants multiple models, using them is fine. |
Ok, thanks! Good to know. But username worked in remote template in my test. Just the second model wasn't replaced. I'll try it again, but haven't much time the next days. Would be nice to have it working in remote templates to update parts of the site. |
template:
Green border shows the content of rendered remote template with replaced variables. Output around comes from the loaded page itself with the model and tlx. If I update firstname from developer tools all fields update as should. locale and remote loaded template contents. |
It worked fine after I removed the second model! |
Special case... if "initial content" (innerHtml of a html element) is set and a t-content attribute is added too. Would it possible to keep initial innerHtml content until t-content is NOT empty? |
@pwFoo version 1.0.43 has been pushed. If the value of t-content is null or undefined then the original content will remain. If the value of t-content is anything else, including the empty string, the original content will be replaced. |
Hi @anywhichway,
It works fine to set a string to
t-content
, but I tried to bind a variable as done inside of html elements witht-content
.I have a remote template, which loads fine after bug #15 was fixed.
Now I try to bind a variable instead of a text / html string to be flexible and easy update element content by ajax calls.
I see the initial html element content without
t-content
or values liket-content="my value"
works fine and replaces the html content as should.Just with variable like
${myvar1}
is will be empty.Is it supported to bind t-content to a variable?
The text was updated successfully, but these errors were encountered: