mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
24 lines
639 B
TypeScript
24 lines
639 B
TypeScript
import { Component } from '@angular/core';
|
|
import { trigger, transition, state, animate, style } from '@angular/animations';
|
|
|
|
@Component({
|
|
selector: 'app-open-close-boolean',
|
|
// #docregion trigger-boolean
|
|
animations: [
|
|
trigger('openClose', [
|
|
state('true', style({ height: '*' })),
|
|
state('false', style({ height: '0px' })),
|
|
transition('false <=> true', animate(500))
|
|
])
|
|
],
|
|
// #enddocregion trigger-boolean
|
|
templateUrl: 'open-close.component.2.html',
|
|
styleUrls: ['open-close.component.css']
|
|
})
|
|
export class OpenCloseBooleanComponent {
|
|
isOpen = false;
|
|
|
|
toggle() {
|
|
this.isOpen = !this.isOpen;
|
|
}
|
|
}
|