Fix: Recipe Ingredient autocomplete focusing and clearing properly
This commit is contained in:
parent
6653121a6f
commit
1b80c52763
@ -32,7 +32,7 @@
|
||||
<md-datepicker md-placeholder="Valid To" ng-model="recipe.ValidTo"></md-datepicker>
|
||||
</div>
|
||||
<div layout-gt-sm="row">
|
||||
<md-autocomplete md-selected-item="product" md-search-text="searchIngredient"
|
||||
<md-autocomplete md-selected-item="product" md-search-text="searchIngredient" focus-on="foIngredient"
|
||||
md-autofocus="recipe.RecipeItems.length > 0" md-items="item in products(searchIngredient, {})"
|
||||
md-item-text="item.Name" on-return="add()"
|
||||
focus-on="foProduct" md-autoselect md-no-cache="true" md-floating-label="Ingredient" flex="50">
|
||||
|
@ -14,6 +14,7 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
|
||||
recipe.ValidFrom = moment(recipe.ValidFrom, 'DD-MMM-YYYY').toDate();
|
||||
recipe.ValidTo = moment(recipe.ValidTo, 'DD-MMM-YYYY').toDate();
|
||||
$scope.recipe = recipe;
|
||||
$scope.foIngredient = recipe.RecipeItems > 0;
|
||||
|
||||
$scope.costPrice = 0;
|
||||
function getOld(productID, recipeItems) {
|
||||
@ -40,7 +41,8 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
|
||||
}
|
||||
delete $scope.quantity;
|
||||
delete $scope.product;
|
||||
$scope.foProduct = true;
|
||||
$scope.searchIngredient = '';
|
||||
$scope.foIngredient = true;
|
||||
};
|
||||
|
||||
$scope.removeItem = function (item) {
|
||||
@ -106,8 +108,6 @@ var RecipeController = ['$scope', '$location', '$window', '$modal', 'asDateFilte
|
||||
$scope.delete();
|
||||
});
|
||||
};
|
||||
$scope.foName = true;
|
||||
|
||||
$scope.products = function ($viewValue, options) {
|
||||
return Product.autocomplete(angular.extend({term: $viewValue, count: 20, a: true, e: true}, options)).$promise;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user