AngularJS on IE10+ ,textarea with placeholder cause “Invalid argument.”

后端 未结 3 1014
执笔经年
执笔经年 2021-01-07 19:22

I\'m getting \"Invalid argument\" when using angularJS ,TextArea with placeholder, on IE10+.

This will ONLY happen when the textarea node is closed with

3条回答
  •  既然无缘
    2021-01-07 20:00

    I know this question is now pretty old, but thought I'd throw in my thoughts too. We ran into this issue several months ago and had to drum up a fix, so we ended up using this directive to solve the problem:

    mod.directive('placeHolder', [
        function(){
            return {
                restrict: 'A',
                link: function(scope, elem, attrs){
                    scope.$watch(attrs.placeHolder, function(newVal,oldVal){
                        elem.attr('placeholder', newVal);
                    });
                }
            };
        }
    ]);
    

    And then you can use it in your views:

    
    

    Once your model data arrives (possibly asynchronously), the directive will add a traditional placeholder attribute to the