Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {Component, OnInit, Output} from '@angular/core';
- import {StoryModel} from '../model/StoryModel';
- import {StorydetailsbarService} from '../story-details/service/storydetailsbar.service';
- @Component({
- selector: 'app-stories-bar',
- templateUrl: './stories-bar.component.html',
- styleUrls: ['./stories-bar.component.css']
- })
- export class StoriesBarComponent implements OnInit {
- allSt: StoryModel[];
- @Output()
- stories: StoryModel[] = [
- {idCard: 1, storyContent: 'xxx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 2, storyContent: 'xxx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 3, storyContent: 'Mxxxice', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXX'},
- {idCard: 4, storyContent: 'Mr. xx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXXX'},
- {idCard: 5, storyContent: 'Mr. xx', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: null},
- {idCard: 6, storyContent: 'x. Nice', storyPoints: '2', priority: 'low', date: null, ifFinished: true, assignee: 'XXXX'},
- ];
- i: number;
- story: any;
- constructor(private storydetailsbarService: StorydetailsbarService) {
- }
- ngOnInit() {
- // console.log(this.storydetailsbarService + 'zzzzzzzz');
- // this.storydetailsbarService.sendStories(this.stories);
- this.storydetailsbarService.addStory({
- idCard: this.getLastId() + 1, storyContent: 'xxxx', storyPoints: '8',
- priority: 'low', date: null, ifFinished: true, assignee: 'John'
- });
- console.log('------------' + this.storydetailsbarService.getStories());
- this.allSt = this.storydetailsbarService.getStories();
- for (const i of this.stories) {
- console.dir('+_+_+_+_+_+_+_' + i.storyContent);
- }
- this.storydetailsbarService.allStories.subscribe(allS => {
- console.log('------------' + this.allSt);
- console.log('grooososss' + allS.values().next().value.idCard);
- this.allSt = allS;
- this.stories = allS;
- });
- for (const i of this.allSt) {
- console.log('grooososssxxxx' + i.storyContent);
- }
- this.i = 0;
- console.log('0932785932728974392849324');
- this.getLastId();
- this.storydetailsbarService.currentMessage.subscribe(message => this.i = message);
- }
- newMessage() {
- this.storydetailsbarService.sendId(this.i);
- }
- OnClick(story) {
- this.i = story.idCard;
- console.log(this.i + ' *******************************');
- this.storydetailsbarService.sendId(this.i);
- this.storydetailsbarService.sendStoryDetails(story);
- }
- getLastId() {
- const last = this.stories[this.stories.length - 1];
- console.log(last.idCard);
- return last.idCard++;
- // this.stories.values();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement