Page MenuHomec4science

info-box.component.ts
No OneTemporary

File Metadata

Created
Sat, Sep 28, 03:29

info-box.component.ts

import { Component, Input, OnInit} from '@angular/core';
import {MatExpansionModule} from '@angular/material/expansion';
import { Subscription } from 'rxjs';
import { InfoService } from '../services/info.service';
import { Word } from '../word';
@Component({
selector: 'app-info-box',
templateUrl: './info-box.component.html',
styleUrls: ['./info-box.component.css']
})
export class InfoBoxComponent {
@Input() manuscript: any;
information: string = "test";
word: Word;
subscription: Subscription;
showInfo: boolean = false;
expansion: boolean = true;
constructor(private infoService: InfoService, private matExpansionModule: MatExpansionModule){
this.subscription = infoService.wordChange$.subscribe(
word => {
if (this.word === word){
this.toggleShowInfo();
this.word = null;
} else {
this.word = word;
if (!this.showInfo){
this.toggleShowInfo();
}
}
});
}
toggleShowInfo(){
this.showInfo = !this.showInfo;
}
}

Event Timeline