最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ng-focus and ng-blur events not triggering in Angularjs - Stack Overflow

programmeradmin2浏览0评论
<input type='text' ng-focus='tryFunc()'> </input>

The function tryFunc() is not called when the input box is focused.

I am including jQuery.min.js in the file and it is before angular.min.js jQuery is version v1.10.2 and Angular.js is v1.0.7.

What may be happening?

<input type='text' ng-focus='tryFunc()'> </input>

The function tryFunc() is not called when the input box is focused.

I am including jQuery.min.js in the file and it is before angular.min.js jQuery is version v1.10.2 and Angular.js is v1.0.7.

What may be happening?

Share Improve this question asked Aug 31, 2013 at 14:19 Program_SauceProgram_Sauce 2832 gold badges7 silver badges14 bronze badges 1
  • For anyone else arriving here looking for a working example of ng-focus / ng-blur in 1.2.x: jsfiddle.net/b8zRG/1 – rdjs Commented Dec 18, 2013 at 15:37
Add a comment  | 

2 Answers 2

Reset to default 13

ngFocus is not available on Angular 1.0.7. It's available on Angular 1.2.

You can create your own ngFocus directive, it's quite simple, have a look here:

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

works with version 1.2.17 See demo

https://gist.github.com/anonymous/35636e7c020d50aeab18

发布评论

评论列表(0)

  1. 暂无评论