本文整理匯總了TypeScript中angular.IWindowService.prompt方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IWindowService.prompt方法的具體用法?TypeScript IWindowService.prompt怎麽用?TypeScript IWindowService.prompt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular.IWindowService
的用法示例。
在下文中一共展示了IWindowService.prompt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: switch
this.addFilter = (filter: string) => {
let itemNameFilter = false;
if (filter === 'item name') {
itemNameFilter = true;
filter = $window.prompt($i18next.t('Filter.EnterName')) || '';
filter = filter.trim();
}
if (filter === 'notes:value') {
itemNameFilter = true;
filter = $window.prompt($i18next.t('Filter.EnterNote')) || '';
filter = `notes:"${filter.trim()}"`;
}
if (
filter.indexOf('light:') === 0 ||
filter.indexOf('quality:') === 0 ||
filter.indexOf('stack:') === 0
) {
const type = filter.split(':');
const lightFilterType = type[1];
let light = $window.prompt(`Enter a ${type[0]} value:`);
if (light) {
light = light.trim();
} else {
return;
}
filter = `${type[0]}:`;
switch (lightFilterType) {
case 'value':
filter += light;
break;
case '>value':
filter += `>${light}`;
break;
case '>=value':
filter += `>=${light}`;
break;
case '<value':
filter += `<${light}`;
break;
case '<=value':
filter += `<=${light}`;
break;
default:
filter = '';
break;
}
}
const text = SearchService.query;
if (itemNameFilter) {
SearchService.query = filter + (text.length ? ` ${text}` : '');
} else if (`${text} `.indexOf(`${filter} `) < 0) {
SearchService.query = text.length > 0 ? `${text} ${filter}` : filter;
}
};