मैं अपने कोड में http://aehlke.github.com/tag-it/ उपयोग कर रहा हूँ के साथ tagit का उपयोग कैसे करें कैसे viewmodelआपकी सहायता के लिए अग्रिम में नॉकआउट
एचटीएमएल
<ul data-bind='jqueryui: "tagit",foreach: Tags' >
<li class="tagit-choice ui-widget-content ui-state-default ui-corner-all" data-bind='with: $data'>
<span class="tagit-label" data-bind='text: $data'></span>
<a class="tagit-close">
<span class="text-icon">×</span>
<span class="ui-icon ui-icon-close"></span>
</a>
<input type="hidden" name="item[tags][]" data-bind='value: $data' style="display: none;">
</li>
</ul>
जे एस कोड
function AppViewModel() {
var self = this;
function Tag(data) {
this.Name = data;
}
self.Tags = ko.observableArray([
new Tag('red'),
new Tag('blue'),
new Tag('green')
]);
}
// Activates knockout.js
ko.applyBindings(new AppViewModel());
धन्यवाद के साथ बाध्य करने के लिए!
इसके अलावा, मैं अद्यतन भाग में एक त्रुटि फिक्स्ड, तो यह डेटा से नमूदार में है कि उपयोग कर सकते हैं शुरुआत –
क्या आप टैगऑटोकॉम्प्लटर और टैगप्रोसेसर के लिए कोड स्निपेट शामिल कर सकते हैं? – NullReference
मैंने उन लोगों के साथ मूल उत्तर अपडेट किया है + मामूली अपडेट :) –