Answer the question
In order to leave comments, you need to log in
Why does transclude not work with input?
Hello.
There is an input:
<input type="text" name="name" value="0" rt-number/>
angular.module('Wasya').directive('rtNumber', function(){
return {
restrict : 'A',
link : function($scope, el, attr){/*тут всякий код*/},
template: '<div class="wrap" ng-transclude></div>', // и если <ng-transclude></ng-transclude> тоже не работает
transclude : true,
scope : {}
};
});
<div class="wrap" ng-transclude>
<input type="text" name="name" value="0" rt-number/>
</div>
Answer the question
In order to leave comments, you need to log in
And what result do you expect? And what do you get when the div element?
transclude serves to substitute the contents of the element on which the directive is hung in ng-transclude.
And when you hang it on an imput, the imput remains and template is inserted into it. Although it's strange, why bother with the imput tag at all, it's not right at all.
See what you want to do.....
<!-- before directive -->
<input type="text" name="name" value="0" rt-number />
<!-- after directive -->
<input type="text" name="name" value="0" rt-number>
<div class="wrap" ng-transclude></div>
</input>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question