This is a quick setup of bootstrap typeahead when your source is an array of object :
$('.typeahead').typeahead({
source: $.map(data, function(obj) { return obj[property]; })
});
if you use underscore.js :
Simple example on how to make Twitter Bootstrap typeahead working with backbone collections. | |
Usage : | |
var bui = new Bootstrap.Typeahead({ | |
collection: ? | |
property: ? | |
items: ? | |
... | |
}); |
This is a quick setup of bootstrap typeahead when your source is an array of object :
$('.typeahead').typeahead({
source: $.map(data, function(obj) { return obj[property]; })
});
if you use underscore.js :
Usage: | |
collection.searchBy({attribute: "searched value", attribute: "searched value", ...}); | |
collection.search("query"); |
Typeahead = Backbone.View.extend({ | |
tagName: 'input', | |
attributes: {"data-provide": "typeahead"}, | |
initialize: function(options){ | |
this.property = this.options.property; | |
this.keyValue = this.options.keyValue; | |
}, | |
render: function() { | |
this.$el.typeahead({ | |
source: this.collection.models, |
Powering HTML with AngularJS.
Simple Twitter Bootstrap dropdown demo powered by AngularJS.
This method is based on AngularJS attributes. the "dropdown" master DOM is listening "open" variable. if it's true ng-class add the open css class else it's remove. the ng-click event set "open" variable.
var Hapi = require('hapi'), | |
server = new Hapi.Server(); | |
server.connection(); | |
var users = { | |
john: { | |
username: 'john', | |
password: 'john', | |
name: 'John Doe', |