在angular2中自动调整textarea的大小 [英] autosize textarea in angular2
问题描述
我正在从事angular2应用.我有自动调整textarea大小的要求. 我正在尝试从 https://github.com/stevepapa/angular2-autosize https://github.com/stevepapa/angular2-autosize
I am working on angular2 applciation. i have a requirement to autosize textarea. I am trying to reuse the angular2-autosize from https://github.com/stevepapa/angular2-autosize
遵循自述文件,但出现以下错误
Followed the readme, But I am getting the below error
未捕获的错误:模块构建失败:错误:ENOENT:没有此类文件或目录,打开'C:\ Users \ Vipin \ SampleApp \ node_modules \ angular2-autosize \ angular2-autosize.js'.
Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open 'C:\Users\Vipin\SampleApp\node_modules\angular2-autosize\angular2-autosize.js'.
请提出如何解决此问题的建议.
Please suggest how to overcome this issue.
推荐答案
更新(15.04.2018) 对其进行了打包,现在可以将其打包为
Update (15.04.2018) Managed to package it, now its available as
npm install ngx-autosize
https://github.com/chrum/ngx-autosize
旧答案:
我今天遇到了同样的问题,并已解决! 请检查我的叉子: https://github.com/chrum/angular2-autosize
I had the same problem today and got it fixed! Please check my fork: https://github.com/chrum/angular2-autosize
在PR合并之前,请尝试:
Until PR is merged try:
npm install https://github.com/chrum/angular2-autosize.git --save
然后在您的代码中,因为它略有不同,所以您只是导入模块而不是指令...
And then in your code, because it's slightly different, you just import module not directive...
所以 代替:
import {Autosize} from 'angular2-autosize';
@NgModule({
...
declarations: [
Autosize
]
...
})
您应该拥有:
import {AutosizeModule} from 'angular2-autosize';
@NgModule({
...
imports: [
AutosizeModule
]
...
})
这篇关于在angular2中自动调整textarea的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!