Move undefined check to correct place

This commit is contained in:
Anaggh S 2020-05-27 17:03:50 +05:30
parent 1e0a919137
commit 873fbab56b
1 changed files with 3 additions and 3 deletions

View File

@ -62,14 +62,14 @@
}, },
templateResult: function(data) { templateResult: function(data) {
// console.log(data); // console.log(data);
if (typeof data.id === 'undefined') {
return '';
}
var html = ''; var html = '';
if (data.type=='menu') { if (data.type=='menu') {
html += '<a href="'+data.url+'"><div class="search-suggestion">'; html += '<a href="'+data.url+'"><div class="search-suggestion">';
html += '<span class="fa fa-'+data.icon+'"></span>'+data.text+'</div></a>'; html += '<span class="fa fa-'+data.icon+'"></span>'+data.text+'</div></a>';
} else { } else {
if (typeof data.id === 'undefined') {
return '';
}
html += '<div class="search-suggestion">'; html += '<div class="search-suggestion">';
html += '<div class="search-suggestion-item">'+data.text+' <span class="badge badge-pill badge-light">'+data.type+'</span></div>'; html += '<div class="search-suggestion-item">'+data.text+' <span class="badge badge-pill badge-light">'+data.type+'</span></div>';
html += '<div class="search-suggestion-options">'; html += '<div class="search-suggestion-options">';