2016-09-24 5 views
0

テンプレートにアニメーショントリガー名をバインドするとエラーが発生します。 [@triggerName]は機能していないようです。私は何が欠けていますか?Angular2 RC4アニメーショントリガーバインディングエラー

コンポーネント

import {Component, ViewChild, ViewChildren, Input, ElementRef, Renderer} from '@angular/core'; 
import {trigger, state, style, transition, animate} from '@angular/core'; 
import 'rxjs/add/operator/map'; 

@Component({ 
    selector: 'Header', 
    templateUrl: '/components/header/header.html', 
    directives: [], 

providers: [], 
    host: {'(document:click)': 'closeLoginModal($event)'}, 
    animations: [ 
     trigger('showLoginTrigger', [ 
      state('true', style({opacity: '1',})), 
      state('false', style({opacity: '0',})), 
      transition('0 => 1', animate('400ms ease-in')), 
      transition('1 => 0', animate('400ms ease-out')) 
     ]) 
    ] 
}) 
export class Header { 
    static get parameters() { 
     return [[ElementRef]]; 
    } 
    constructor(ElementRef) { 
     this.el = ElementRef.nativeElement; 
     this.showLogin = true; 
     this.showMenu = false; 
     this.test = true; 
    } 
    closeLoginModal(e) { 
     if (this.el.contains(e.target)) return; 
     this.showLogin = false; 
    } 
} 

テンプレートジェイド

button.no-border((click)='test=!test') LOGIN 
    .login-modal(*ngIf='showLogin', [@showLoginTrigger]='test') 
     h2 
      | Publisher 
      br 
      | Login 

私は取得していますエラーは次のとおりです。

ことがないので '@showLoginTrigger' にバインドできません既知のネイティブ プロパティ

答えて

3

問題が[@showLoginTrigger] = 'テスト'


RC4が構文である:それはあるべき@ showLoginTrigger = 'テスト'


RC5以降[@showLoginTrigger ] = 'テスト'

+1

Geez、SMH。本当にありがとう! –

+0

あなたは大歓迎です! – micronyks

関連する問題