yyx990803/vue — pull request #119 by BrandonPierce (2014-02-20 20:47:52+00:00)
Title: adding control directive

This directive is an attempt to decouple as much of the DOM as possible from our ViewModel. With this directive you can set a control for the ViewModel scope with a specified key. Therefore instead of doing (using jQuery for quick example):

``` html

{{ message }}

```

``` js
var demo = new Vue({
el: '#demo',
data: {
message: 'Hello Vue.js!'
},
method: {
fadeIn: {
var el = $(this.$el),
// what if our class name changes??
subControl = $('.sub-control', el);

subControl.fadeIn();
}
}
})
```

You can do this instead:

``` html

{{ message }}

```

``` javascript
var demo = new Vue({
el: '#demo',
data: {
message: 'Hello Vue.js!'
},
method: {
fadeIn: {
// does not care what class is, references controls key instead
$(this.$controls['sub-control']).fadeIn();
}
}
})
```

Currently the directive will accept all letters, numbers, and `-_` characters as key values for the $controls object.