2016-06-14 14:24:39 +08:00
|
|
|
app.directive('inputAuto',function(){
|
|
|
|
return{
|
|
|
|
restrict: 'A',
|
|
|
|
scope: {},
|
|
|
|
link: function(scope, element){
|
2016-07-13 16:53:17 +08:00
|
|
|
var copyContainer = element.parent().children().children().eq(0);
|
|
|
|
var sendButton = element.next();
|
2016-06-14 14:24:39 +08:00
|
|
|
element.on('input',function(){
|
2016-07-22 16:09:47 +08:00
|
|
|
//console.log(sendButton);
|
2016-06-14 14:24:39 +08:00
|
|
|
copyContainer.html(element[0].value);
|
2016-07-19 15:41:40 +08:00
|
|
|
var textHeight = copyContainer[0].scrollHeight-10;
|
2016-06-14 14:24:39 +08:00
|
|
|
element.css('height', textHeight + 'px');
|
|
|
|
});
|
|
|
|
sendButton.on('click',function(){
|
2016-07-19 15:41:40 +08:00
|
|
|
element.css('height','18px');
|
2016-06-14 14:24:39 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|