Encountering an issue with the customer directive of auto-complete, as I am receiving the error
Uncaught SyntaxError: Unexpected token )
. This error is displayed in the console of the chrome browser as VM80623:1 Uncaught SyntaxError: Unexpected token )
. Clicking on VM80623:1
leads to void();
in File name VM80623
The same error persists even when implementing the directive from the following link where you can type any character, use the auto-complete search box, and select an option.
Link:
(function () {
'use strict';
var app = angular.module('app');
app.directive('Autocomplete', ['Authentication', '$http', function(AuthenticationService, $http){
return {
restrict : 'AEC',
require: 'ngModel',
scope: {
modeldisplay:'= modeldisplay'
},
templateUrl: 'directives/autocomplete/autocomplete.html',
link: function(scope, element, attrs, ctrl){
scope.searchCustomer = function(customerSearch){
var params = {
'session_key': Authentication.GetSessionKey(),
'q': customerSearch
};
if (!customerSearch){
return;
}
var url = config.url+'/api/search';
return $http.post(url, params).then(function(response){
var data = response.data;
if(data.error == 0) {
scope.TypeAheadData = data.result;
return data.result;
}
});
}
scope.handleSelection = function(item){
ctrl.$setViewValue(item);
scope.modeldisplay = item;
scope.selected = true;
};
scope.isCurrent = function(index) {
return scope.current == index;
};
scope.setCurrent = function(index) {
scope.current = index;
};
}
};
}]);
})();