简体   繁体   English

Angular 8 如何在service.ts文件中使用动画过渡和触发器

[英]Angular 8 how to use Animations transitions and triggers in a service.ts file

Angular 8 how to use Animations transitions and triggers in a service.ts file? Angular 8 如何在service.ts文件中使用Animations过渡和触发器? Here is the reference of angular animation that is working ok in the component but I want to use this in a service that is imported in component flie.这是 angular animation 的参考,它在组件中工作正常,但我想在组件中导入的服务中使用它。

https://angular.io/guide/transition-and-triggers https://angular.io/guide/transition-and-triggers

Working Demo 工作演示

I am assuming when you say animations in service, you want to reuse the animations.我假设当您说正在使用的动画时,您想重用动画。

You can export the animation from an animations file.您可以从动画文件中导出 animation。 在此处输入图像描述

Then in you component, you can import the animation.然后在您的组件中,您可以导入 animation。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular2,如何在service.ts中使用JSON数据? - Angular2, How to use JSON data in service.ts? 如何从 service.ts 文件中的 Component.ts 文件调用 function,该文件在 angular 的同一组件中 - How to Call function from Component.ts file in service.ts file which is in the same component in angular 如何更改service.ts angular中的变量值? - How to change variable value in service.ts angular? 如何在angular service.ts中传递fix变量? - How to pass fix variable in angular service.ts? 从角度为6的service.ts返回undefined - return undefined from service.ts in angular 6 如何绑定选择/选项值以在service.ts中而不是component.ts中获得请求功能(角度8) - How to bind selected/option value to get request function in service.ts and not component.ts (Angular 8) 如何在发射成功时处理从 service.ts 到 component.ts 的 socket.io 确认 Angular 8 - How to handle socket.io acknowledgement from service.ts to component.ts on emit success Angular 8 如何将 component.ts 中的变量发送到 service.ts 进行身份验证 Angular - How to send variable in component.ts to service.ts for authentication Angular 如何在另一个函数中更改变量后在另一个函数中获取新值,在 Angular ...service.ts - How to get the new value of a variable in another function after it was changed inside a different function, in Angular ...service.ts 两个可注射(service.ts)能否以角度4相互通信? - can two injectable (service.ts) communicate with each other in angular 4?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM