2017-10-17 31 views
7

Öğelere açısal geçişi uygulamaya çalışıyorum ancak çalışmıyor. Web-animasyon-j'leri de ekledim, ancak yine de bir etkisi yok. OnMouseLeave ve OnMouseOver fonksiyonları üzerine uygulanmasını eklendiangular2 geçiş animasyonu çalışmıyor

// package.json

"web-animations-js": "^2.3.1", 

// liste öğesi

<li class="list-group-item" (mouseover)="onMouseover()" (mouseleave)="onMouseleave()" [@usrSt]="st" [routerLink]= "['/users', i+1, person.name]" *ngFor="let person of (personsList | filter:coursestat:'chosenCourse'); let i = index"> 

// liste bileşeni

@Component({ 
    selector: 'app-list', 
    templateUrl: './list.component.html', 
    styleUrls: ['./list.component.css'], 
    animations: [ 
    trigger('usrSt', [ 
     state('active', style({ 'background-color': '#cfd8dc' })), 
     state('inactive', style({ 'bacckground-color': '#fff' })), 
     transition('active => inactive', animate('1400ms ease-in')), 
     transition('inactive => active', animate('400ms ease-out')) 
    ]) 
    ] 
}) 

     export class ListComponent implements OnInit, OnDestroy { 

     public personsList; 
     @Input() id; 
     st; 
     @Input() coursestat: string; 

     constructor(private getDt: InputDataService) { 

     } 

     ngOnInit() { 
     this.personsList = this.getDt.personArr; 
     console.log(this.personsList); 
     this.st = Array.from(this.personsList, _ => 'active'); 
     console.log(this.id); 
     } 

     ngOnDestroy() { 
     console.log('destroy list'); 
     } 

     onMouseover() { 
     this.st = 'active'; 
     } 
     onMouseleave() { 
     this.st = 'inactive'; 
     } 

    } 

// plunkr tarafından Caio Philipe

https://plnkr.co/edit/CrusaB3iCnhDPIVu2oa5?p=preview

+0

çalışmalıdır. "OnMouseover" ve "onMouseleave" nin uygulaması nerede? – caiofilipemr

+0

, kodu güncellediler – SONGSTER

+0

Modül ithalatını "app.module" dosyasına eklediniz mi? 'imports: [BrowserModule, BrowserAnimationsModule]' – caiofilipemr

cevap

2

CSS özelliği çalışmıyor coz özelliği bacckground-color doğru yazılmamıştır. bunu düzelt ve tekrar dene.

+0

lol'u dikkate almayı düşünür müsünüz? Evet çalıştı. Bunu nasıl fark etmedim. oh tanrım bütün gün neyin yanlış olduğunu anlamaya çalıştım. Teşekkürler – SONGSTER

İlgili konular