【发布时间】:2018-04-28 23:34:34
【问题描述】:
我有 user.component.html 和 user.component.ts
我发现的所有示例都以这种方式在 html 中<input type="file" />
我不想使用这种风格。我的 html 文件中有:
<button type="button" class="btn" (click)="openPicture()" Browse </button>
下面是ts文件上的函数:
public openPicture() {
//for testing
console.log('button clicked to open picture');
var picture = browse.the.picture.and.assing.to.this.variable;
//another test, see on console if picture is read
console.log('%c ', 'font-size: 100px; background: {{picture}} no-repeat;');
// Later display picture variable on html and save to database or do anything desired.
}
我在stackoverflow 上找到了example 和angular/material,但我没有这个模块。有没有其他替代方法,无需安装任何额外的包来解决这个问题?
【问题讨论】:
标签: javascript html angularjs spring typescript