SHARE
TWEET

Untitled

a guest Jun 17th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit } from '@angular/core';
  2. import { UserService } from '../user.service';
  3.  
  4. @Component({
  5. selector: 'app-offrea',
  6. templateUrl: './offrea.component.html',
  7. styleUrls: ['./offrea.component.scss']
  8. })
  9. export class OffreaComponent implements OnInit {
  10.  
  11. loginuser: any = {};
  12. offres: any[] = [];
  13. services: any[] = [];
  14. countList: any[] = [];
  15. count: number;
  16. constructor(private service: UserService) {
  17. this.service.getAllOffer().subscribe(o => {
  18.   this.offres = o;
  19. });
  20. this.service.getServices().subscribe(ser => {
  21.   this.services = ser;
  22. });
  23. this.f(this.offres, this.services);
  24. console.log(this.countList);
  25. }
  26. ngOnInit() {
  27. }
  28.  
  29. f (a1,a2) {
  30. for (let i = 0; i < a1.length; i++) {
  31. this.count = 0;
  32. for (let z = 0; z < a2.length; z++) {
  33. if( a1[i].services.serviceName === a2[z].serviceName) {
  34. this.count++;
  35. this.countList.push(this.count);
  36. }
  37.    }
  38. this.count = 0;
  39.  }
  40. }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top