Skip to content

Various clarifications #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions source/api/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
<div id="my_div" v-component="Profile"></div>
```

``` js
new Profile({
el = "#my_div"
})
```
For more details see [Composing ViewModels](/guide/composition.html).

### v-ref

Expand Down
2 changes: 1 addition & 1 deletion source/api/instantiation-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<script type="x-template">` trick to include templates.
If it starts with `#` it will be used as a querySelector and use the selected element's innerHTML as the template string. This allows the use of the common `<script type="x-template">` trick to include templates.

<p class="tip">Vue.js uses DOM-based templating. The compiler walks through DOM elements and looks for directives and creates data bindings. This means all Vue.js templates are parsable HTML that can be converted into actual DOM elements by the browser. Vue.js converts string templates into DOM fragments so they can be cloned when creating more ViewModel instances. If you want your templates to be valid HTML, you can configure the directive prefix to start with `data-`.</p>

Expand Down