Skip to content
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

Replacing content of element #17

Closed
michaelowens opened this issue Aug 25, 2015 · 2 comments
Closed

Replacing content of element #17

michaelowens opened this issue Aug 25, 2015 · 2 comments

Comments

@michaelowens
Copy link

All the examples seem to append by doing e.g. $$(#app).append <todolist>.

I can't seem to find any reference in the ElementTag to a function that would replace the content. Am I missing it or could this be something that that could be added?

Could be nice for e.g. placeholders.

<div id="app">Loading...</div>

and then e.g. like in jQuery:

$$(#app).html <todolist>
@somebee
Copy link
Member

somebee commented Aug 25, 2015

Sorry for the extreme lack of documentation at the moment. Usually you would not even use append, as static rendering (like in http://imba.io/#/examples/dynamic.imba) is much easier and more intuitive. You should be able to do $$(#app).children = ["Loading...",<li>] or if it is just text, you can do $$(#app).text = "Loading..."

If your div has id #app you don't need $$(#app) to select it by the way, all elements with id can be accessed directly through #myid. So it would be:

#app.text = "Loading..."
.. waiting for something ...
#app.children = [<todolist>]

Could also do #app.empty.append <todolist>

@michaelowens
Copy link
Author

Oh, I see. Thanks for clearing that up. It's sometimes a bit of a hassle, but maybe also fun to be more pushed towards the source and figuring out how it works. None the less, loving the language so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants