form.components.ts如何2個部件之間的角共享一個觸發器2
import {Component, animate, state, style, trigger, transition} from "@angular/core";
@Component({
selector:'form',
templateUrl: 'assets/template/form.html',
inputs : ['departure','destination'],
animations:[
trigger('focusPanel',[
state('inactiv',style({
bottom: '-999px',
display: 'none',
position: 'fixed',
background: '#eee',
width: '100%',
height: '100%',
})),
state('activ',style({
bottom: '0px',
display: 'block',
background: '#eee',
position: 'fixed',
'z-index' : '2',
width: '100%',
height: '100%',
})),
transition('inactiv => activ', animate('600ms ease-in')),
transition('activ => inactiv', animate('600ms ease-out'))
])
]
})
export class FormComponents{
state : string = 'inactiv';
OpenModal(){
this.state = 'activ';
}
CloseModal(){
this.state = 'inactiv';
}
}
form.html
<div class="search-fliht-input" placeholder="Orașul de plecare" id="air-port-from" (click)="OpenModal()"></div>
search.component.ts
search.html
<div class="city-select-container open" [@focusPanel]="state" (click)="CloseModal()"><div>
問題是我不知道如何共享組件之間的觸發器,觸發器按鈕位於表單組件中,需要出現的div位於搜索組件中
如何使用SearchComponent? – RezaRahmati
基本上是一個彈出窗口 –
我需要一些發送[@focusPanel] =「狀態」(點擊)=「formControler.CloseModal()」從窗體組件到搜索組件 –