import { AfterViewInit, Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'slider', templateUrl: './slider.component.html', styleUrls: ['./slider.component.scss'] }) export class SliderComponent implements OnInit { @Input() width: 'string'; @Input() side: 'left'|'right' ='right'; css:any; constructor( private router:Router ){} ngOnInit(){ this.css = { 'left-side': this.side=='left', 'right-side': this.side=='right' } } close() { this.router.navigate([{outlets: {slider: null}}]).then(); } }