Comments (12)
And ifnot query is not correctly working
from jsblocks.
Could you provide more information on your scenario. There are tests about render and ifnot which are passing for every built and I guess that it some custom scenario that's failing.
from jsblocks.
Here is my console with errors
http://oi59.tinypic.com/dh5y6r.jpg
The variable "fullLayout" is bollean
from jsblocks.
Yeah. I understand now. The console messages are not correct but I have already fixed them couple of weeks ago but they are still not part of any release. I will create a release next week. For the error render() is support only in each() query
- this means that render()
could be called only inside each()
binding because it is not useful elsewhere. I will show an example:
<ul data-query="each([1, 2, 3])">
<!-- render() could be used here -->
<li data-query="render(true)"></li>
</ul>
from jsblocks.
Ok, understood. But what about ifnot query?
And I need to function like Angular ng-if for partial rendering depending on different conditions. How can I do it?
from jsblocks.
ifnot
query is working. It just logs incorrect messages to the console. This is fixed in the latest code. You could use visible()
query to show and hide particular sections.
from jsblocks.
Ok, thank you. Closed
from jsblocks.
Seems to me that the ability to conditionally not render elements in a view based on values from the view instead of just having to use visible()
which just hides them using CSS is valuable and render()
could be used for that.
One simple case I can think of is if there is an img
tag where the model's value for the source is falsey and it would be nice to just not include the img
tag at all instead of just hiding it.
In that case it would be <img data-query="render(profile_img)" src="{{profile_img}}">
.
Perhaps there is another way to do this in jsblocks that I'm missing.
from jsblocks.
Thanks for the idea.
What the benefit of removing the element would be? Are you using server-side rendering?
from jsblocks.
In this case I'm not using server-side rendering, was just looking for a solution the client-side that would allow me to exclude the element conditionally. A case would be if I loaded some data from localstore after a route change let's say and wanted to not include an element conditionally. I can see how in most cases visible
is what you want, but in some cases, img
tags being one, it's nice to have control over if the element shows up at all. I suppose I could just use some JS to remove the element from the logic in the view, but it would be nice to be able to have a data-query
that allowed conditionally including elements.
from jsblocks.
Ahaa. Ok. I understand now. I agree and have created an issue for this here.
from jsblocks.
👍 Really enjoying working with this framework, thank you for all your effort.
from jsblocks.
Related Issues (20)
- observable event handle not binding correctly to DOM HOT 4
- Define views in different instances of time HOT 6
- Issues with the 'sort'-extender.
- How to disable print log in the console for production mode? HOT 2
- Roadmap e.g. custom components, fixes HOT 3
- How can I use route GET?Thank you! HOT 2
- The push state is not working when I press back button from my browser. HOT 6
- Evaluation of index in 'for' loop for modified collection is sometimes incorrect HOT 4
- How can we use asset pipeline library with jsblocks server. HOT 3
- Can't import Jquery? HOT 2
- data-query set value to options not working in Chrome & Firefox HOT 3
- TypeError: undefined is not an object (evaluating 'e.$this=a[o]') HOT 3
- blocks enables XSS security breaches with enduser supplied data HOT 1
- How to use reuse HTML Tags? HOT 2
- Change buildsystem to wrap modules in selfexecuting closure. HOT 3
- Add a method to execute expressions for external libs. HOT 5
- Make models behavior for non obervable value consistent. HOT 4
- Prevent the {{expressions}} from showing up in the client at loading time HOT 5
- Is jsblocks a node only solution? HOT 2
- "Cannot read property 'children' of undefined" if static file have no dom HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsblocks.