Skip to content

Instantly share code, notes, and snippets.

@xjamundx
Forked from jquerygeek/views
Last active December 14, 2015 05:09
Show Gist options
  • Save xjamundx/5033788 to your computer and use it in GitHub Desktop.
Save xjamundx/5033788 to your computer and use it in GitHub Desktop.
define(function(require) {
var Backbone = require('backbone')
var template = require('text!../../template/newThread.html')
return Backbone.View.extend({
el: '#container',
template: _.template(template),
initialize: function () {
this.render()
var Contact = require('model/contact')
var Contacts = require('collection/contacts')
var ContactList = new Contacts([
{"name": "backbone-autocomplete"},
{"name": "backbone-memento"},
{"name": "backbone-validations"},
{"name": "backbone-chosen"},
{"name": "backbone-relational"},
{"name": "backbone-bindings"},
{"name": "backbone-boilerplate"},
{"name": "backbone-traversal"},
{"name": "backbone-factory"},
{"name": "jquery"},
{"name": "jquery-ui"},
{"name": "angular.js"},
{"name": "keymaster.js"}
])
console.log(ContactList);
var view = new AutoCompleteView({
input: $("#to"),
model: ContactList,
onSelect: function (model) {
alert('zia')
}
})
console.log(view, view.input, view.$el, view.el, view.input.outerWidth());
view.render()
console.log(view, view.input, view.$el, view.el, view.input.outerWidth());
},
render: function() {
alert('rendering')
this.$el.html(this.template({}));
return this;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment