説明なし

overlaysdemo.component.ts 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import {Component, OnInit} from '@angular/core';
  2. import {ConfirmationService, MessageService} from 'primeng/api';
  3. import {Product} from '../domain/product';
  4. import {ProductService} from '../service/productservice';
  5. import {AppBreadcrumbService} from '../../app.breadcrumb.service';
  6. @Component({
  7. templateUrl: './overlaysdemo.component.html',
  8. styleUrls: ['./overlaysdemo.scss'],
  9. providers: [ConfirmationService, MessageService]
  10. })
  11. export class OverlaysDemoComponent implements OnInit {
  12. images: any[];
  13. display: boolean;
  14. products: Product[];
  15. selectedProduct: Product;
  16. visibleSidebar1;
  17. visibleSidebar2;
  18. visibleSidebar3;
  19. visibleSidebar4;
  20. visibleSidebar5;
  21. constructor(private productService: ProductService, private confirmationService: ConfirmationService,
  22. private messageService: MessageService, private breadcrumbService: AppBreadcrumbService) {
  23. this.breadcrumbService.setItems([
  24. { label: 'UI Kit' },
  25. { label: 'Overlay', routerLink: ['/uikit/overlay'] }
  26. ]);
  27. }
  28. ngOnInit() {
  29. this.productService.getProductsSmall().then(products => this.products = products);
  30. this.images = [];
  31. this.images.push({
  32. source: 'assets/demo/images/sopranos/sopranos1.jpg',
  33. thumbnail: 'assets/demo/images/sopranos/sopranos1_small.jpg', title: 'Sopranos 1'
  34. });
  35. this.images.push({
  36. source: 'assets/demo/images/sopranos/sopranos2.jpg',
  37. thumbnail: 'assets/demo/images/sopranos/sopranos2_small.jpg', title: 'Sopranos 2'
  38. });
  39. this.images.push({
  40. source: 'assets/demo/images/sopranos/sopranos3.jpg',
  41. thumbnail: 'assets/demo/images/sopranos/sopranos3_small.jpg', title: 'Sopranos 3'
  42. });
  43. this.images.push({
  44. source: 'assets/demo/images/sopranos/sopranos4.jpg',
  45. thumbnail: 'assets/demo/images/sopranos/sopranos4_small.jpg', title: 'Sopranos 4'
  46. });
  47. }
  48. confirm1() {
  49. this.confirmationService.confirm({
  50. key: 'confirm1',
  51. message: 'Are you sure to perform this action?'
  52. });
  53. }
  54. confirm2(event: Event) {
  55. this.confirmationService.confirm({
  56. key: 'confirm2',
  57. target: event.target,
  58. message: 'Are you sure that you want to proceed?',
  59. icon: 'pi pi-exclamation-triangle',
  60. accept: () => {
  61. this.messageService.add({severity: 'info', summary: 'Confirmed', detail: 'You have accepted'});
  62. },
  63. reject: () => {
  64. this.messageService.add({severity: 'error', summary: 'Rejected', detail: 'You have rejected'});
  65. }
  66. });
  67. }
  68. }

Powered by TurnKey Linux.