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
public class Person { | |
/** The first name. */ | |
private String firstName; | |
/** The last name. */ | |
private String lastName; | |
/** | |
* Returns the full name of the person. |
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
public dropped(event: CdkDragDrop<Item[], Item[], Item>) { | |
// VirtualScrolling and CdkDropList don’t work well together. | |
// Workaround solution: set the correct previousIndex manually. | |
event.previousIndex = event.previousContainer.data.findIndex( | |
(item) => item.id === event.item.data.id | |
); | |
// ... | |
} |
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
// TODO: Revert temporary changes (special handle of bugged type) | |
// when backend issue is resolved. | |
public onSelection(selected: SomeObjectWithType): void { | |
if (selected.type === ObjectType.TypeWithBug)) { | |
// handles buggy case separately | |
} else { | |
// original behavior | |
} | |
} |
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
// Check if our hero can defeat the villain | |
if (hero.strength > villain.strength && | |
hero.energy > 30 && | |
!villain.bersekerMode) { | |
// ... | |
} |
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
if (hero.canDefeat(villain)) { | |
// ... | |
} |
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
// Don't run unless you got more than 10 GB of RAM free. | |
// Alternatively, decrease the value of N. | |
public void _testWithLargeN() { | |
// ... | |
} |
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
<cdk-virtual-scroll-viewport | |
*ngIf="items?.length" | |
class="selection-list col-lg-7" | |
[itemSize]="74" | |
> | |
<div | |
class="item" | |
[ngClass]="{ selected: selectedItems[item.id] }" | |
*cdkVirtualFor="let item of items" | |
(click)="selectItem(item)" |
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
<app-selection-list | |
[items]="pandas$ | async" | |
(selectionChanged)="updateSelection($event)" | |
> | |
<ng-template #itemTemplate let-item> | |
<app-panda [panda]="item"></app-panda> | |
</ng-template> | |
</app-selection-list> |
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
<app-selection-list | |
[items]="movies$ | async" | |
(selectionChanged)="updateSelection($event)" | |
> | |
<ng-template #itemTemplate let-item> | |
<app-movie [movie]="item"></app-movie> | |
</ng-template> | |
</app-selection-list> |
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: 'app-selection-list', | |
templateUrl: './selection-list.component.html', | |
styleUrls: ['./selection-list.component.scss'], | |
changeDetection: ChangeDetectionStrategy.OnPush | |
}) | |
export class SelectionListComponent { | |
public selectedItems: SelectedItems = {}; | |
@Input() items!: IdOwner[] | null; |
OlderNewer