Advertisement
Guest User

aaaaaaaaaaaaaaaa

a guest
May 21st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. import {Component, OnInit, Output} from '@angular/core';
  2. import {StoryModel} from '../model/StoryModel';
  3. import {StorydetailsbarService} from '../story-details/service/storydetailsbar.service';
  4.  
  5. @Component({
  6. selector: 'app-stories-bar',
  7. templateUrl: './stories-bar.component.html',
  8. styleUrls: ['./stories-bar.component.css']
  9. })
  10. export class StoriesBarComponent implements OnInit {
  11. allSt: StoryModel[];
  12. @Output()
  13. stories: StoryModel[] = [
  14. {idCard: 1, storyContent: 'xxx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
  15. {idCard: 2, storyContent: 'xxx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
  16. {idCard: 3, storyContent: 'Mxxxice', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXX'},
  17. {idCard: 4, storyContent: 'Mr. xx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXXX'},
  18. {idCard: 5, storyContent: 'Mr. xx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
  19. {idCard: 6, storyContent: 'x. Nice', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXXX'},
  20.  
  21. ];
  22. i: number;
  23. story: any;
  24.  
  25. constructor(private storydetailsbarService: StorydetailsbarService) {
  26. }
  27.  
  28. ngOnInit() {
  29. // console.log(this.storydetailsbarService + 'zzzzzzzz');
  30.  
  31. // this.storydetailsbarService.sendStories(this.stories);
  32. this.storydetailsbarService.addStory({
  33. idCard: this.getLastId() + 1, storyContent: 'xxxx', storyPoints: '8',
  34. priority: 'low', date: null, ifFinished: true, assignee: 'John'
  35. });
  36. console.log('------------' + this.storydetailsbarService.getStories());
  37. this.allSt = this.storydetailsbarService.getStories();
  38. for (const i of this.stories) {
  39. console.dir('+_+_+_+_+_+_+_' + i.storyContent);
  40. }
  41. this.storydetailsbarService.allStories.subscribe(allS => {
  42. console.log('------------' + this.allSt);
  43.  
  44. console.log('grooososss' + allS.values().next().value.idCard);
  45. this.allSt = allS;
  46. this.stories = allS;
  47. });
  48. for (const i of this.allSt) {
  49. console.log('grooososssxxxx' + i.storyContent);
  50. }
  51. this.i = 0;
  52. console.log('0932785932728974392849324');
  53. this.getLastId();
  54. this.storydetailsbarService.currentMessage.subscribe(message => this.i = message);
  55.  
  56.  
  57. }
  58.  
  59. newMessage() {
  60. this.storydetailsbarService.sendId(this.i);
  61. }
  62.  
  63. OnClick(story) {
  64. this.i = story.idCard;
  65. console.log(this.i + ' *******************************');
  66. this.storydetailsbarService.sendId(this.i);
  67. this.storydetailsbarService.sendStoryDetails(story);
  68. }
  69.  
  70. getLastId() {
  71. const last = this.stories[this.stories.length - 1];
  72. console.log(last.idCard);
  73. return last.idCard++;
  74. // this.stories.values();
  75. }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement