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.

Has method with scope name only

See original GitHub issue

Versions:

  • VueJs: 2.5.13
  • Vee-Validate: 2.0.1

Description:

I want to display a block of error message in my component. All v-validate are associated with data-vv-scope.

Now, i’ve created a bloc for that : <span class="danger" v-show="errors.has('scope.field1') || errors.has('scope.field2')"> {{ errors.first('scope.field1') }} {{ errors.first('scope.field2') }} </span> It’s work. I wondering if it that possible to shorten that. like errors.has(‘scope.*’) or scope alone, my tests isn’t working with it. with that, can I make a for loop to display every messages ? Thanks.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
logaretmcommented, Jun 3, 2018

It is now implemented as suggested: errors.has('scope.*')

0reactions
elenamf86commented, Nov 22, 2019

You can display every errors for one scope like this:

<div v-show="errors.any('SCOPE_NAME')" class="error-message">
        <ul>
		<li v-for="error in errors" v-if="error.scope=='SCOPE_NAME'">
			{{ error.msg }}
		</li>
	</ul>
</div>

or like this:

<div v-show="errors.any('SCOPE_NAME')" class="error-message">
        <ul>
		<li v-for="error in errors.all('SCOPE_NAME')">
			{{ error}}
		</li>
	</ul>
</div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

scope and class method with the same name - Stack Overflow
I have removed my conversations controller and actions but this is still showing. Is it possible that a Gem Scope and method are...
Read more >
How to Use Scopes in Ruby on Rails - RubyGuides
Scopes are custom queries that you define inside your Rails models with the scope method. Every scope takes two arguments: A name, which...
Read more >
How to optimize your search with Named Scopes in Rails 5
A named scope is simply a class method inside of your model that always returns an active record association. Imagine this application: we...
Read more >
Scope/Function names and labels - Rosetta Code
If the object is in scope, the method will be. A subroutine is really just another type of object. It has a code...
Read more >
Understanding Scope and Visibility in C# | Pluralsight
Class level scoped variables, like c in our case, can only be accessed by the non-static method of the class in which they...
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