Skip to content

Commit 57fa804

Browse files
alefra86thePunderWoman
authored andcommittedJun 10, 2022
docs: remove Component and Directives (#45828)
Move all content to example-zippy.component.ts PR Close #45828
1 parent 008111d commit 57fa804

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,7 @@
1-
import { Component, Directive, Input, TemplateRef, ContentChild, HostBinding, HostListener } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-root',
55
templateUrl: './app.component.html'
66
})
77
export class AppComponent {}
8-
9-
@Directive({
10-
selector: 'button[appExampleZippyToggle]',
11-
})
12-
export class ZippyToggleDirective {
13-
@HostBinding('attr.aria-expanded') ariaExpanded = this.zippy.expanded;
14-
@HostBinding('attr.aria-controls') ariaControls = this.zippy.contentId;
15-
@HostListener('click') toggleZippy() {
16-
this.zippy.expanded = !this.zippy.expanded;
17-
}
18-
constructor(public zippy: ZippyComponent) {}
19-
}
20-
21-
// #docregion zippycontentdirective
22-
@Directive({
23-
selector: '[appExampleZippyContent]'
24-
})
25-
export class ZippyContentDirective {
26-
constructor(public templateRef: TemplateRef<unknown>) {}
27-
}
28-
// #enddocregion zippycontentdirective
29-
30-
let nextId = 0;
31-
32-
@Component({
33-
selector: 'app-example-zippy',
34-
templateUrl: 'example-zippy.template.html',
35-
})
36-
export class ZippyComponent {
37-
contentId = `zippy-${nextId++}`;
38-
@Input() expanded = false;
39-
// #docregion contentchild
40-
@ContentChild(ZippyContentDirective) content!: ZippyContentDirective;
41-
// #enddocregion contentchild
42-
}

0 commit comments

Comments
 (0)
Please sign in to comment.