I have this function :
$scope.SearchTicketEvent = function (ticketPinOrEvent)
{
if (ticketPinOrEvent != undefined)
You might use the typeof to test if a variable is number.
if (typeof ticketPinOrEvent === 'number') {
$scope.PinTicketSearch(ticketPinOrEvent);
}
Or might try this:
if (!isNaN(ticketPinOrEvent) && angular.isNumber(ticketPinOrEvent)) {
$scope.PinTicketSearch(ticketPinOrEvent);
}
Testing against NaN:
NaN compares unequal
(via ==, !=, ===, and !==)to any other value -- including to another NaN value. UseNumber.isNaN()orisNaN()to most clearly determine whether a value is NaN. Or perform a self-comparison: NaN, and only NaN, will compare unequal to itself.