Last active
May 19, 2020 08:20
-
-
Save michaelilyin/0fae00c959ff771311d2d17e90a589cf to your computer and use it in GitHub Desktop.
Find an issue and propose decision
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<button (click)="config.expanded = !config.expanded">{{ config?.expanded ? 'Collapse' : 'Expand' }}</button> | |
<hrh-expandable-info [config]="config"></hrh-expandable-info> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; | |
import { ExpandableConfig } from '../expandable-info/expandable-info.component'; | |
@Component({ | |
selector: 'hrh-container', | |
templateUrl: './container.component.html', | |
styleUrls: ['./container.component.scss'], | |
changeDetection: ChangeDetectionStrategy.OnPush | |
}) | |
export class ContainerComponent implements OnInit { | |
config: ExpandableConfig = { | |
title: 'Harry Potter', | |
description: 'The Boy Who Lived', | |
expanded: false | |
}; | |
constructor() {} | |
ngOnInit(): void {} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="title">{{ config?.title }}</div> | |
<div *ngIf="config?.expanded" class="description">{{ config?.description }}</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, ChangeDetectionStrategy, Input } from '@angular/core'; | |
export interface ExpandableConfig { | |
title: string; | |
description: string; | |
expanded: boolean; | |
} | |
@Component({ | |
selector: 'hrh-expandable-info', | |
templateUrl: './expandable-info.component.html', | |
styleUrls: ['./expandable-info.component.scss'], | |
changeDetection: ChangeDetectionStrategy.OnPush | |
}) | |
export class ExpandableInfoComponent implements OnInit { | |
@Input() config?: ExpandableConfig; | |
constructor() {} | |
ngOnInit(): void {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment