Skip to content

Commit

Permalink
docs: move ZippyToggleDirective (#45828)
Browse files Browse the repository at this point in the history
Move ZippyToggleDirective from app.component.ts

PR Close #45828
  • Loading branch information
alefra86 authored and jessicajaniuk committed Jun 10, 2022
1 parent 57fa804 commit eafe988
Showing 1 changed file with 13 additions and 1 deletion.
@@ -1,4 +1,16 @@
import { Component, Directive, Input, TemplateRef, ContentChild} from '@angular/core';
import { Component, Directive, Input, TemplateRef, ContentChild, HostBinding, HostListener } from '@angular/core';

@Directive({
selector: 'button[appExampleZippyToggle]',
})
export class ZippyToggleDirective {
@HostBinding('attr.aria-expanded') ariaExpanded = this.zippy.expanded;
@HostBinding('attr.aria-controls') ariaControls = this.zippy.contentId;
@HostListener('click') toggleZippy() {
this.zippy.expanded = !this.zippy.expanded;
}
constructor(public zippy: ZippyComponent) {}
}

let nextId = 0;

Expand Down

0 comments on commit eafe988

Please sign in to comment.