Skip to content

Instantly share code, notes, and snippets.

@pglazkov
Created November 20, 2017 15:36
Show Gist options
  • Save pglazkov/64e16b44f25ac89cbce2f080ffa83e07 to your computer and use it in GitHub Desktop.
Save pglazkov/64e16b44f25ac89cbce2f080ffa83e07 to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
import { SharedData } from '../shared-data';
@Component({
selector: 'app-sidebar',
template: `
Item count: <span>{{ getItemCount() | async }}</span>
`
})
export class SidebarComponent {
constructor(private sharedData: SharedData) { }
getItemCount() {
return this.sharedData.value.map(d => d.items.length);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment