मैं यूई-चयन का उपयोग करने की कोशिश कर रहा हूं और घटक मेरी सरणी की सफाई कर रहा है।कोणीय यूई-चयन एकाधिक स्वच्छ एनजी-मॉडल मान
उदाहरण:
{{ vm.staff_hotels }}
<ui-select multiple ng-model="x" theme="bootstrap">
<ui-select-match placeholder="Not selected">{{$item.name}}</ui-select-match>
<ui-select-choices repeat="hotel.id as hotel in vm.hotels | filter: {active: true} | filter: $select.search">
<div ng-bind-html="hotel.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
मेरे चर "vm.staff_hotels" स्क्रीन पर मूल्य है [1,2]।
{{ vm.staff_hotels }}
<ui-select multiple ng-model="vm.staff_hotels" theme="bootstrap">
<ui-select-match placeholder="Not selected">{{$item.name}}</ui-select-match>
<ui-select-choices repeat="hotel.id as hotel in vm.hotels | filter: {active: true} | filter: $select.search">
<div ng-bind-html="hotel.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
लेकिन, यदि मैं एनजी-मॉडल में चर का उपयोग करता हूं तो मेरा मान [शून्य, शून्य] में बदल जाता है।
क्या आईडी 1 और 2 के साथ होटल हैं? – DTing
क्या आप अपनी समस्या के लिए एक jsfiddle बना सकते हैं। –
यह समस्या है, मेरे पास एक ही कोड दूसरे नियंत्रक में अच्छी तरह से काम कर रहा है, इसलिए, मुझे यह जानना होगा कि यह क्यों हो रहा है, क्योंकि यह डिफ़ॉल्ट व्यवहार नहीं है। – luigibertaco