本文整理汇总了TypeScript中@ng-vcl/ng-vcl.AlertService.open方法的典型用法代码示例。如果您正苦于以下问题:TypeScript AlertService.open方法的具体用法?TypeScript AlertService.open怎么用?TypeScript AlertService.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ng-vcl/ng-vcl.AlertService
的用法示例。
在下文中一共展示了AlertService.open方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
return errors.pipe(switchMap(err => {
return this.alert.open({
text: 'Retry?',
type: AlertType.Warning,
showCancelButton: true,
});
}));
示例2: retry
retry() {
// This fake async request will fail the first time
let fails = 0;
const fakeAsync = async(new Date().toLocaleTimeString(), () => ++fails <= 1);
// Add a retry routine using an alert
const fakeAsyncWithRetries = fakeAsync.pipe(retryWhen(errors => {
return errors.pipe(switchMap(err => {
return this.alert.open({
text: 'Retry?',
type: AlertType.Warning,
showCancelButton: true,
});
}));
}));
this.alert.open({
text: 'Show current time? (will fail the first time)',
showCancelButton: true,
confirmAction: fakeAsyncWithRetries
}).subscribe(result => {
this.alert.info(result.value, { title: 'Time' });
}, err => {
console.log(err);
this.alert.error(String(err ? err.reason : err), { title: 'Error' });
});
}
示例3: loader
loader() {
this.alert.open({
title: 'Loading',
text: 'Hit esc to close loader',
loader: true,
showConfirmButton: false
});
}
示例4: async
async() {
this.alert.open({
text: 'Determine your user agent?',
confirmAction: async(window.navigator.userAgent),
showCancelButton: true
}).subscribe(result => {
this.alert.info(result.value, {
title: 'Your user agent'
});
}, err => {
this.alert.error('Could not determine user agent');
});
}
示例5: question
question() {
this.alert.open({
text: 'Do you really want to delete the file?',
title: 'Delete file?',
type: AlertType.Question,
showCloseButton: true,
showCancelButton: true,
cancelButtonLabel: 'No',
confirmButtonLabel: 'Yes'
}).subscribe((result) => {
this.alert.success('File deleted');
}, err => {
this.alert.error('Reason: ' + err.reason , { title: 'File not deleted' });
});
}
示例6: inputText
inputText() {
this.alert.open({
text: 'What is your name?',
input: AlertInput.Text,
confirmButtonLabel: 'Next',
inputValidator: (value) => {
if (typeof value !== 'string' || value.length < 2) {
throw new Error('This is not your name!');
}
return true;
}
}).subscribe(result => {
this.alert.info('Hello ' + result.value);
}, this.alert.noop);
}
示例7: custom
custom() {
this.alert.open({
text: 'This is a bit customized...',
title: 'Information',
type: AlertType.Info,
showCloseButton: true,
showCancelButton: true,
confirmButtonClass: 'vclSuggestive',
confirmButtonPrepIcon: 'fas:bolt',
cancelButtonColor: 'orange',
customClass: 'vclScale130p',
titleAlignment: AlertAlignment.Center,
contentAlignment: AlertAlignment.Center,
buttonAlignment: AlertAlignment.Center,
});
}