如何创建基于另一个指令逻辑的AngularJS指令? [英] How do I create an AngularJS directive based on another directive logic?

查看:114
本文介绍了如何创建基于另一个指令逻辑的AngularJS指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是pretty新AngularJS和创建指令。

I am pretty new to AngularJS and creating directives.

比方说我想要一个延迟NG-秀,这意味着它应该像 NG-节目,但在2秒后的元素应该是可见的,而不是立即除权pression应验。我不想改变 NG-节目当前行为,只是为了创造一个新的 NG-延迟秀指令。

Lets say I wanted a "delayed ng-show", that means it should work like ng-show, but the element should be visible after 2 seconds as opposed to immediately the expression was fulfilled. I don't want to change the current behavior of ng-show, just to create a new ng-delayed-show directive.

谁能给我一个例子或链接我直接文档了解如何的再利用的或创建的子指令的另一个指令?

Can anyone give me an example or link me to direct documentation on how to reuse or create a sub directive of another directive?

推荐答案

您不必为此创建指令。您可以使用它在内部使用称为缓解CSS能力AngularJS的动画能力非常好做。

You do not need to create directive for this. You can very well do it using animation capabilities of AngularJS which internally uses CSS capability called easing.

阅读文档ngshow和它在这里的动画节 http://docs.angularjs.org /api/ng.directive:ngShow

Read documentation for ngshow and it's animation section here http://docs.angularjs.org/api/ng.directive:ngShow

由于我不是很熟悉,这篇文章可以帮助你http://www.yearofmoo.com/2013/04/animation-in-angularjs.html#how-to-use-animations-in-angularjs

Since i am not very familiar with it, this post can help you http://www.yearofmoo.com/2013/04/animation-in-angularjs.html#how-to-use-animations-in-angularjs

这篇关于如何创建基于另一个指令逻辑的AngularJS指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆