I've tried to answer the question on stackoverflow
(http://stackoverflow.com/questions/24271524/angular-js-nan-handling) and
I've seen strange behavior of angular directive when NaN value is passed to
directive's scope. I can't explain why does it happen, so maybe you could
explain it to me.
It's the directive code:
.directive('test',function(){
return{
restrict: 'E',
template: '<span>Test directive number = {{number}}</span>',
scope: {
number: '='
},
link: function(scope,elem,attrs){
scope.number = scope.number || 10;
}
}
});
If I pass NaN as *number *attribute, link function cannot manipulate with
"scope.number" variable. If I try to change its value even by simply
"scope.number = 5", nothing happens.
Is it a bug in angular or an expected behavior? Why does it happen?
Here is the fiddle: http://jsfiddle.net/aartek/k2r9F/
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.