Welcome to the Alfresco Builder Network

Our technical resource site is still being improved. We'd love to hear your feedback. Tell us what you think

Selectively toggles nodes as favorites.

Basic Usage

    <button mat-icon-button

<adf-document-list #documentList ...>
    selector: 'my-component'
class MyComponent {

    done() {
        // ...


Class members


NameTypeDefault valueDescription
selectionNodeEntry[][]Array of nodes to toggle as favorites.


errorEventEmitter<any>Emitted when the favorite setting fails.
toggleEventEmitter<any>Emitted when the favorite setting is complete.


You can bind the directive instance to a template variable through the adfFavorite reference, which also lets you add extra styling to the element:

    [ngClass]="{ 'icon-highlight': selection.hasFavorites() }"
    <mat-icon [ngClass]="{ 'icon-highlight': selection.hasFavorites() }">
        {{ selection.hasFavorites() ? 'star' : 'star_border' }}

The directive behaves as follows:

  • If there are no favorite nodes in the selection, then all are marked as favorites
  • If there are one or more favorite nodes in the selection, then only those that are not favorites are marked
  • If all nodes in the selection are favorites, then they all have their favorite status removed

See the Demo Shell for examples of usage.

Interested in trying Alfresco?

Try Now