AngularJS指令链接功能不会被调用 [英] AngularJS directive link function not being called

查看:115
本文介绍了AngularJS指令链接功能不会被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的角度-HTTP-auth的库,引导模式窗口。情态动词都工作正常,但我有指令的问题。
这里是一个链接的jsfiddle - http://jsfiddle.net/jCUSh/85/ 。我想补充一点,会被调用指令,并且增加了听众。我已经简化了的jsfiddle的例子,所以你不会看到HTTP-auth的进口。然而scope.on('')元素仍留有(只要不破反正图片)。

I am trying to use angular-http-auth library with bootstrap modal window. Modals are working fine but I have problems with directives. Here is a jsfiddle link - http://jsfiddle.net/jCUSh/85/ . I am trying to add a directive that will be invoked and that adds listeners. I have simplified the example in jsfiddle, so you won't see http-auth imports. However scope.on('') elements are still left (they don't break the picture anyway).

我的问题是 - 为什么不叫链接功能?我加了 elem.addClass('测试')作为一个例子。
我认为解决的办法是超级简单,根本无法看到它。

My question is - why isn't the linking function called? I added elem.addClass('test') as an example. I believe the solution is super simple, just unable to see it.

也不太重要的问题 - 是它确定传递范围作为参数传递给另一个范围是什么?我需要它来关闭模式窗口。

Also less important question - is it ok to pass scope as a parameter to another scope? I need it to close the modal window.

感谢

推荐答案

有两件事在这里打球。

一个是你必须通过属性传递指令,而不是纳克级

One is you must pass the directive through the class attribute and not the ng-class

其次,你传递给restrict属性的C字符是1057(的不是我们通常的ASCII 67字符的ASCII字符)

Secondly, the "C" character you pass to the restrict property is a character with ASCII of 1057 (not our usual ASCII 67 char)

是在固定的演示 http://jsfiddle.net/gaby/jCUSh / 87 /

这篇关于AngularJS指令链接功能不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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