Advertisement
Guest User

asdasdadasda

a guest
May 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. import {EventEmitter, Injectable, Output} from '@angular/core';
  2. import {StoryModel} from '../../model/StoryModel';
  3. import {BehaviorSubject, Observable, Subject} from 'rxjs';
  4.  
  5. @Injectable({
  6. providedIn: 'root'
  7. })
  8. export class StorydetailsbarService {
  9. @Output() story: EventEmitter<StoryModel> = new EventEmitter();
  10. @Output() allStories: EventEmitter<StoryModel[]> = new EventEmitter();
  11. @Output() myMethod: EventEmitter<StoryModel[]> = new EventEmitter();
  12. // private myMethodSubject = new Subject<any>();
  13. // @Output() cardId: EventEmitter<number> = new EventEmitter();
  14. // cardId: number;
  15. stories: StoryModel[] = [
  16. {idCard: 1, storyContent: 'Mr. werwrwdgdfgdfg', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
  17. {idCard: 2, storyContent: 'dfgdj. Nice', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
  18. {idCard: 3, storyContent: 'uyiuy. werewrwreNice', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'Ann'},
  19. {idCard: 4, storyContent: 'werwr', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'John'},
  20. {idCard: 5, storyContent: 'Mr. erwrerw', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
  21. {idCard: 6, storyContent: 'Mr. erfe', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'John'},
  22.  
  23. ];
  24.  
  25. private cardId = new BehaviorSubject(0);
  26. currentMessage = this.cardId.asObservable();
  27.  
  28. sendStoryDetails(story) {
  29. this.story.emit(story);
  30. }
  31.  
  32. constructor() {
  33. }
  34.  
  35. sendId(i: number) {
  36. // this.cardId.emit(i);
  37. this.cardId.next(i);
  38. }
  39.  
  40. addStory(story) {
  41.  
  42. console.log(story.storyContent + '?????????????????');
  43. this.stories.push(story);
  44. // console.dir(this.stories + '?????????????????');
  45. }
  46.  
  47. getStories() {
  48. console.log('kotekotkrotkroktrok');
  49. const x = this.stories;
  50. console.log('x ' + x);
  51. return x;
  52. }
  53.  
  54. sendStories(stories: StoryModel[]) {
  55. // this.stories = stories;
  56. this.myMethod.emit(stories);
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement