ng-focus和ng-blur事件不会在Angularjs中触发

Pro*_*uce 8 javascript jquery angularjs

<input type='text' ng-focus='tryFunc()'> </input>
Run Code Online (Sandbox Code Playgroud)

tryFunc()当输入框被聚焦时,不会调用该函数.

我包含jQuery.min.js在文件中,它是在angular.min.js jQuery版本v1.10.2和Angular.js是v1.0.7之前.

可能会发生什么?

Wag*_*sco 13

ngular 1.0.7上没有ngFocus.它可以在Angular 1.2上使用.

您可以创建自己的ngFocus指令,这很简单,请看一下:

https://gist.github.com/eliotsykes/5394631