question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could v-if exclude empty arrays ? Or is there another way to do it ?

For instance, imagine the given Vue :

<section id='container'>
    <div id='list-wrapper' v-if='list << I would here mean : "if list is not empty" >>'>
        <h5>List of things</h5>
        <ul>
            <li v-repeat='item: list'>{{ item }}</li>
        </ul>
    </div>
</section>

new Vue({
    el: '#container',
    data: function () {
        return {
            list: []
        }
    },
    events: {
        'list:add': function (item) {
            this.list.push(item);
        }
    }
});

When list is an empty array, I would prefer the content of <div id='list-wrapper'></div> not to be included in the DOM. I would prefer it to be included only when I push some items in my listarray.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

97reactions
multimericcommented, Jan 14, 2015
<div id='list-wrapper' v-if="list.length > 0">
</div>

And here’s a fiddle: http://jsfiddle.net/4t6hjwev/1/

28reactions
LinusBorgcommented, Nov 29, 2017

I’m sorry to hear that.

But I have a question: What exactly are we supposed to do with that statement, posted to a two year old, closed issue with zero information about the exact problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can you configure singe mode VIF on NetApp array?
Find out from this article how to configure a singe mode VIF on NetApp array. For example if we have 2 (or more)...
Read more >
Variance Inflation Factor (VIF) Explained - Python
The Variance Inflation Factor (VIF) is a measure of colinearity among predictor variables within a multiple regression. It is calculated by ...
Read more >
Set parameterized virtual interface for an array of agents
I am trying to create virtual interface with parameterized value for an array of agents. ``` interface trig_if #(parameter width=16) (input ...
Read more >
Detecting Multicollinearity with VIF - Python - GeeksforGeeks
Generally, a VIF above 5 indicates a high multicollinearity. ... exog : an array containing features on which linear regression is performed ...
Read more >
Creating Python Function to Iterate over List/DataFrame (VIF)
... while True: Cols = range(x_vif.shape[1]) vif = np.array([variance_inflation_factor(x_vif.values, i) for i in Cols]) if all(vif < thres): ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found