refactor(js): improve defintion of some controllers

This commit is contained in:
Francis Lachapelle committed 2022-05-16 17:43:35 -04:00
1 parent 5c0d8c11da
commit 0cf025b0af
2 files changed
+26 -28

No files matched your search

@@ -135,18 +135,18 @@
}
// Method to call on data changes
vm.onChange = function() {
var form = $scope[vm.formName],
input = form[vm.inputName],
this.onChange = function() {
var form = $scope[this.formName],
input = form[this.inputName],
rawSearchText = input.$viewValue;
if (vm.allowDot && rawSearchText == '.' || form.$valid && rawSearchText) {
if (this.allowDot && rawSearchText == '.' || form.$valid && rawSearchText) {
if (rawSearchText == '.')
// Ignore the minlength constraint when using the dot operator
input.$setValidity('minlength', true);
// doSearch is the compiled expression of the sg-search attribute
vm.doSearch($scope, { searchText: rawSearchText, searchField: vm.searchField });
this.doSearch($scope, { searchText: rawSearchText, searchField: this.searchField });
}
};