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.
-
Having trouble understanding the question. Could you post an example or jsfiddle?David K. Hess– David K. Hess2015-07-16 02:18:32 +00:00Commented 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.Jibin Mathew– Jibin Mathew2015-07-20 11:50:49 +00:00Commented Jul 20, 2015 at 11:50
Add a comment
|
1 Answer
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.