3

Suppose I have a custom directive that fetches an array result from certain location , How could I possibly use v-repeat alongside my directive internally rather than separately calling v-repeat externally.

2
  • Having trouble understanding the question. Could you post an example or jsfiddle? Commented Jul 16, 2015 at 2:18
  • What i meant was suppose i write a custom directive which obtains a json array from the server then is there a way i could use v-repeat within my directive so that i can bind the array within my directive itself. rather than using a v-repeat externally. Commented Jul 20, 2015 at 11:50

1 Answer 1

1

In Vue, you normally use directives (http://vuejs.org/guide/index.html#Directives) to modify the behavior of an existing DOM element. The behavior you are describing is more suited to a component (http://vuejs.org/guide/index.html#Components).

You would declare a component with a template attribute that either inline or via reference to a <script> style template would have markup that would include usage of v-repeat.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.