Skip to content
This repository was archived by the owner on Oct 14, 2024. It is now read-only.
This repository was archived by the owner on Oct 14, 2024. It is now read-only.

[How-to] Jquery plugin - Add Swiped Carousel and other plugins #341

Closed
@zmnv

Description

@zmnv

Trying to use animation from inside of other functions in component by this.togglestates("goHide");.
Tryed to use ViewEncapsulation.None also, or without it. No animation.

imports ...

@Component({
  changeDetection: ChangeDetectionStrategy.Default,
  encapsulation: ViewEncapsulation.Emulated,
  selector: 'layer-discount',
  templateUrl: './discount.component.html',
  animations: [
    trigger('visibilityChanged', [
      state('shown' , style({ opacity: 1 })),
      state('hidden', style({ opacity: 0 })),
      transition('* => *', animate('.4s'))
    ])
  ]
})

export class DiscountComponent implements OnInit { 

state: string ='show';

 togglestates(STATE) {
    if(STATE == 'goShow') {
      setTimeout(function(){
        this.state = 'show';
      }, 800);
    }
    if(STATE == 'goHide') {
      setTimeout(function(){
        this.state = 'hidden';
      }, 800);
    }
  }

}

html:

    <div [@visibilityChanged]="state">
      <h3>{{nigma.text}}</h3>
    </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions