当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript AlertService.open方法代码示例

本文整理汇总了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,
   });
 }));
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:7,代码来源:demo.component.ts

示例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' });
    });
  }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:27,代码来源:demo.component.ts

示例3: loader

 loader() {
   this.alert.open({
     title: 'Loading',
     text: 'Hit esc to close loader',
     loader: true,
     showConfirmButton: false
   });
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:8,代码来源:demo.component.ts

示例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');
   });
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:13,代码来源:demo.component.ts

示例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' });
   });
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:15,代码来源:demo.component.ts

示例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);
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:15,代码来源:demo.component.ts

示例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,
   });
 }
开发者ID:ng-vcl,项目名称:ng-vcl,代码行数:16,代码来源:demo.component.ts


注:本文中的@ng-vcl/ng-vcl.AlertService.open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。