Skip to content

Instantly share code, notes, and snippets.

@AhsanAyaz
Created April 9, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhsanAyaz/c378fbc18f6bfde63ec9392020d15722 to your computer and use it in GitHub Desktop.
Save AhsanAyaz/c378fbc18f6bfde63ec9392020d15722 to your computer and use it in GitHub Desktop.
ListItemComponent for NgKeyListDemo app
import { Component, OnInit, Input, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'app-list-item',
templateUrl: './list-item.component.html',
styleUrls: ['./list-item.component.scss']
})
export class ListItemComponent implements OnInit {
@Input() item;
@Output() itemSelected = new EventEmitter<any>();
isActive: boolean;
constructor() { }
ngOnInit() {
this.isActive = false;
}
setActive(val) {
this.isActive = val;
}
selectItem() {
this.itemSelected.emit(this.item);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment