From 0c123d20e1adad857a1fbbbdc87dd2861ebafe86 Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 30 Sep 2014 23:41:47 +1000 Subject: [PATCH] Various clarifications --- source/api/directives.md | 14 ++++++++++++-- source/api/instantiation-options.md | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/api/directives.md b/source/api/directives.md index 077ef7e22b..370213fc50 100644 --- a/source/api/directives.md +++ b/source/api/directives.md @@ -143,7 +143,7 @@ For detailed examples, see [Displaying a List](/guide/list.html). - This directive creates child ViewModels. - This directive can trigger transitions. -Conditionally instantiate ViewModels, using the bound value as the Component ID to look up constructors with. When the bound value changes, existing ViewModel will be destroyed and a new ViewModel will be created. When a ViewModel is created, the original element will be replaced, but all attributes will be copied to the new element. For more details, see [Routing](/guide/application.html#Routing). +Conditionally instantiate ViewModels, using the bound value as the Component ID to look up constructors with. When the bound value changes, existing ViewModel will be destroyed and a new ViewModel will be created. When a ViewModel is created, the original element will be replaced, but all attributes will be copied to the new element. Note that this dyamic instantiaion differs from `v-component`, which instantiates a fixed ViewModel based on the attribute value. For more details, see [Routing](/guide/application.html#Routing) ### v-with @@ -186,7 +186,17 @@ Example inheriting individual properties (using the same data): ### v-component -Compile this element as a child ViewModel with a registered component constructor. This can be used with `v-with` to inehrit data from the parent. For more details see [Composing ViewModels](/guide/composition.html). +Compile this element as a child ViewModel with a registered component constructor. This can be used with `v-with` to inehrit data from the parent. Note that using `v-component` is the declarative equivalent of instantiating a component, meaning that the following two code snippets are equivalent: +``` html +
+``` + +``` js +new Profile({ + el = "#my_div" +}) +``` +For more details see [Composing ViewModels](/guide/composition.html). ### v-ref diff --git a/source/api/instantiation-options.md b/source/api/instantiation-options.md index e70c48abf9..ce1d47bc95 100644 --- a/source/api/instantiation-options.md +++ b/source/api/instantiation-options.md @@ -129,7 +129,7 @@ Provide the ViewModel with an existing DOM element. It can be either a `querySel A string template to be inserted into `vm.$el`. Any existing markup inside `vm.$el` will be overwriiten. If the **replace** option is `true`, the template will replace `vm.$el` entirely. -If it starts with `#` it will be used as a querySelector and use the selected element's innerHTML and the template string. This allows the use of the common `