<input ng-model="t" ng-change="updateV()" ng-blur="blur()" ng-focus="blur()" ng-click="blur()"/>
I make a fiddle to this question:/
anyone can help? thx!
<input ng-model="t" ng-change="updateV()" ng-blur="blur()" ng-focus="blur()" ng-click="blur()"/>
I make a fiddle to this question:http://jsfiddle/tjfdfs/6Mqd6/
anyone can help? thx!
Share Improve this question asked Sep 16, 2013 at 8:04 tjfdfstjfdfs 73910 silver badges26 bronze badges 5- Which version are you using? Try using version 1.2.0 – AlwaysALearner Commented Sep 16, 2013 at 8:08
- I read source of todoMVC of angular. he write todoBlur and todoFocus directives manually. So can I conclude this: I still need to write these two directives by myself? – tjfdfs Commented Sep 16, 2013 at 8:11
- Not if you 're using version 1.2.0. in which these are already included. – AlwaysALearner Commented Sep 16, 2013 at 8:14
- @CodeHater, thanks, I use 1.1.1 because it's latest version provided by jsfiddle . I will try 1.2.0 and see if it can work. – tjfdfs Commented Sep 16, 2013 at 8:15
- You can load the version of your choice using the <script tag in the fiddle. – AlwaysALearner Commented Sep 16, 2013 at 8:50
2 Answers
Reset to default 3Both ng-focus
and ng-blur
directives are not supported in the current stable branch (1.0.x). The corresponding code has been added to master just 2 months ago.
Expect to have them in 1.2.0 branch. Actually, if you're able to work with the products marked as unstable in your application, try 1.2.0rc1 to have them supported already.
I'm working with angular 1.07 and as much as I know it does not support ng-blur nor ng-focus at all. You will have to write them by your self as follows.
var myApp = angular.module('myApp', ['App_ui']);
angular.module("App_ui", []).directive('uiBlur', function () {
return function (scope, elem, attrs) {
elem.bind('blur', function () {
scope.$apply(attrs.uiBlur);
});
};
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745624251a4636708.html
评论列表(0条)