Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import { Component, OnInit, SystemJsNgModuleLoader } from '@angular/core';
  2. import { NgForm } from '@angular/forms';
  3.  
  4.  
  5. import { Prodotti } from 'src/app/model/prodotti.model';
  6. import { Router, ActivatedRoute } from '@angular/router';
  7. import { JsonPipe } from '@angular/common';
  8.  
  9. import { ProdottiListService} from 'src/app/features/prodotti/components/prodotti-list/prodotti-list.service';
  10. import { ToastrService } from 'ngx-toastr';
  11.  
  12.  
  13.  
  14. let Header_Msg = "Gestione Prodotti";
  15.  
  16.  
  17. @Component({
  18. selector: 'app-prodotti-list',
  19. templateUrl: './prodotti-list.component.html',
  20. styleUrls: ['./prodotti-list.component.css']
  21. })
  22. export class ProdottiListComponent implements OnInit {
  23.  
  24. constructor(private service: ProdottiListService, private toastr: ToastrService) {
  25.  
  26. }
  27.  
  28. ngOnInit() {
  29. this.service.refreshList();
  30. }
  31.  
  32. populateForm(emp: Prodotti) {
  33. this.service.formData = Object.assign({}, emp);
  34. }
  35.  
  36. onDelete(id: number) {
  37.  
  38. if (confirm('Confermi la cancellazione del Record ?')) {
  39. this.service.deleteProdotti(id).subscribe(res => {
  40. this.service.refreshList();
  41. this.toastr.warning('Cancellazione eseguita con successo', Header_Msg);
  42. })
  43. }
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement