Skip to content

Instantly share code, notes, and snippets.

@thehydroimpulse
Created April 3, 2014 10:47
Show Gist options
  • Save thehydroimpulse/9952273 to your computer and use it in GitHub Desktop.
Save thehydroimpulse/9952273 to your computer and use it in GitHub Desktop.
View
<div class="ui dropdown">
<button class="ui button" type="button" data-title="title">
{{selected ? selected : default}}
</button>
<ul class="ui dropdown-list">
<li data-each="item in list" data-click="select(@id)">{{item.name}}</li>
</ul>
</div>
var view = require('view');
var template = require('./template');
var Dropdown = view()
.use(view.compile(template))
.scope(function(scope, props) {
scope.selected = null;
scope.default = props.default
scope.list = props.list;
});
Dropdown.prototype.select = function(id, scope) {
scope.selected = scope.list[id];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment