當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angular2-alert.AlertService類代碼示例

本文整理匯總了TypeScript中angular2-alert/angular2-alert.AlertService的典型用法代碼示例。如果您正苦於以下問題:TypeScript AlertService類的具體用法?TypeScript AlertService怎麽用?TypeScript AlertService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AlertService類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 onConfirm: (value)=> {
     if (typeof value == 'string' && value.length > 0) {
         this.alertService.swal({title: 'Nice!', text: 'You wrote: ' + value + '', type: 'success'});
     } else {
         this.alertService.showInputError('You need to write something!');
     }
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:7,代碼來源:app.component.ts

示例2: confirmCancelAlert

 confirmCancelAlert() {
     this.alertService.swal({
         title: "Are you sure?",
         text: "You will not be able to recover this imaginary file!",
         type: "warning",
         showCancelButton: true,
         confirmButtonColor: "#DD6B55",
         confirmButtonText: "Yes, delete it!",
         cancelButtonText: "No, cancel plx!",
         onConfirm: ()=> {
             this.alertService.swal({
                 title: 'Deleted!',
                 text: 'Your imaginary file has been deleted.',
                 type: 'success'
             });
         },
         onCancel: ()=> {
             this.alertService.swal({
                 title: 'Cancelled',
                 text: 'Your imaginary file is safe :)',
                 type: 'error'
             });
         }
     });
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:25,代碼來源:app.component.ts

示例3: timerAlert

 timerAlert() {
     this.alertService.swal({
         title: 'Auto close alert!',
         text: 'I will close in 2 seconds.',
         timer: 2000,
         showConfirmButton: false
     });
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:8,代碼來源:app.component.ts

示例4: customAlert

 customAlert() {
     this.alertService.swal({
         title: "Sweet!",
         text: "Here's a custom image.",
         type: "custom",
         imageUrl: "/thumbs-up.jpg"
     });
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:8,代碼來源:app.component.ts

示例5: ajaxAlert

 ajaxAlert() {
     this.alertService.swal({
         title: "Ajax request example",
         text: "Submit to run ajax request",
         type: "info",
         showCancelButton: true,
         showLoaderOnConfirm: true,
         onConfirm: ()=> {
             setTimeout(()=> {
                 this.alertService.swal({title: "Ajax request finished!"});
             }, 3000);
         }
     });
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:14,代碼來源:app.component.ts

示例6: inputAlert

 inputAlert() {
     this.alertService.swal({
         title: "An input!",
         text: "Write something interesting:",
         type: "input",
         showCancelButton: true,
         animation: "slide-from-top",
         inputPlaceholder: "Write something",
         onConfirm: (value)=> {
             if (typeof value == 'string' && value.length > 0) {
                 this.alertService.swal({title: 'Nice!', text: 'You wrote: ' + value + '', type: 'success'});
             } else {
                 this.alertService.showInputError('You need to write something!');
             }
         }
     });
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:17,代碼來源:app.component.ts

示例7: setTimeout

 setTimeout(()=> {
     this.alertService.swal({title: "Ajax request finished!"});
 }, 3000);
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:3,代碼來源:app.component.ts

示例8: titleTextTypeAlert

 titleTextTypeAlert() {
     this.alertService.swal({title: 'Good job!', text: 'You clicked the button!', type: 'success'});
 }
開發者ID:txf7337,項目名稱:angular2-alert,代碼行數:3,代碼來源:app.component.ts


注:本文中的angular2-alert/angular2-alert.AlertService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。