@Pravin我认为我找到了解决办法。当用户在键入输入中选择字典条目时,我遇到需要更新可编辑模式的情况。我一直在寻找解决方案,我发现下面的方法:
<span editable-text="p.name" e-name="name" e-form="productForm" e-required
e-typeahead="product as product.name for product in getProducts($viewValue) | filter:$viewValue | limitTo: 8"
e-typeahead-editable="true" e-ng-maxlength="256" e-typeahead-focus-first="false"
e-typeahead-on-select='onSelectProductFromDictionary($item, $model, productForm)'>
{{ p.name }}
</span>
而且方法,更新xeditable数据:
$scope.onSelectProductFromDictionary = function ($item, $model, form) {
angular.forEach(form.$editables, function(editable) {
if (editable.name === 'name') {
return;
}
editable.scope.$data = $model.something; // this is a dictionary model
editable.save(); // move the value from edit input to view xeditable value
editable.hide(); // hide the specific xeditable input if you needs
});
};
我希望它能帮助。
UPDATE [的jsfiddle]
https://jsfiddle.net/fLc2sdd2/
点击保存按钮更新 –