Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {EventEmitter, Injectable, Output} from '@angular/core';
- import {StoryModel} from '../../model/StoryModel';
- import {BehaviorSubject, Observable, Subject} from 'rxjs';
- @Injectable({
- providedIn: 'root'
- })
- export class StorydetailsbarService {
- @Output() story: EventEmitter<StoryModel> = new EventEmitter();
- @Output() allStories: EventEmitter<StoryModel[]> = new EventEmitter();
- @Output() myMethod: EventEmitter<StoryModel[]> = new EventEmitter();
- // private myMethodSubject = new Subject<any>();
- // @Output() cardId: EventEmitter<number> = new EventEmitter();
- // cardId: number;
- stories: StoryModel[] = [
- {idCard: 1, storyContent: 'Mr. werwrwdgdfgdfg', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 2, storyContent: 'dfgdj. Nice', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 3, storyContent: 'uyiuy. werewrwreNice', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'Ann'},
- {idCard: 4, storyContent: 'werwr', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'John'},
- {idCard: 5, storyContent: 'Mr. erwrerw', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 6, storyContent: 'Mr. erfe', storyPoints: '3', priority: 'low', date: null, ifFinished: true, assignee: 'John'},
- ];
- private cardId = new BehaviorSubject(0);
- currentMessage = this.cardId.asObservable();
- sendStoryDetails(story) {
- this.story.emit(story);
- }
- constructor() {
- }
- sendId(i: number) {
- // this.cardId.emit(i);
- this.cardId.next(i);
- }
- addStory(story) {
- console.log(story.storyContent + '?????????????????');
- this.stories.push(story);
- // console.dir(this.stories + '?????????????????');
- }
- getStories() {
- console.log('kotekotkrotkroktrok');
- const x = this.stories;
- console.log('x ' + x);
- return x;
- }
- sendStories(stories: StoryModel[]) {
- // this.stories = stories;
- this.myMethod.emit(stories);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement