This file contains 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
abstract class MultiCheckOption { } // (1) | |
@Component({ | |
selector: 'simple-check-option', | |
providers: [ | |
{ // (2) | |
provide: MultiCheckOption, | |
useExisting: SimpleCheckOptionComponent, | |
} | |
] |
This file contains 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
@ContentChildren(SimpleCheckOptionComponent) | |
options!: QueryList<SimpleCheckOptionComponent>; |
This file contains 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
@Component({ | |
selector: 'user-check-option', | |
template: ` | |
<label> | |
<input type="checkbox" [formControl]="control"> | |
<div class="card"> | |
<div class="avatar"> | |
<img src="assets/images/{{ value.avatar }}"> | |
<div class="span"></div> | |
</div> |
This file contains 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
private subscriptions = new Subscription(); | |
private selectedValues: any[] = []; | |
ngAfterContentInit(): void { | |
this.options.forEach(option => { | |
this.subscriptions.add( | |
option.valueChanges$.subscribe( | |
(optionChecked) => { | |
if (optionChecked) { | |
this.add(option.value); |
This file contains 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
@Component({ | |
selector: 'multi-check-field', | |
template: `<ng-content></ng-content>` | |
}) | |
export class MultiCheckFieldComponent implements AfterContentInit { | |
@ContentChildren(SimpleCheckOptionComponent) | |
options!: QueryList<SimpleCheckOptionComponent>; | |
ngAfterContentInit(): void { |
This file contains 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
@Component({ | |
selector: 'simple-check-option', | |
template: ` | |
<label> | |
<input type="checkbox" [formControl]="control"> | |
{{ label }} | |
</label> | |
` | |
}) | |
export class SimpleCheckOptionComponent { |
This file contains 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
<multi-check-field> | |
<simple-check-option *ngFor="let option of options" [value]="option" | |
[label]="option.label"> | |
</single-check-option> | |
</multi-check-field> |
This file contains 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
#!/bin/bash | |
# This will create icons in their respective | |
# folders in "$HOME"/.local/share/icons/... | |
# Usage: icongen iconfile | |
# Check usage | |
if [[ $# -ne 2 ]]; then | |
echo "Usage: $0 icon_file new_icon_name" |
This file contains 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
#!/bin/sh | |
# Remove folder that contains other files or directories | |
rm -r mydir | |
# Avoid getting the delete confirmation for each file | |
rm -rf mydir |