这是我在angular中的html视图:
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-6">
<div class="jumbotron">
<h2>Complete your Profile</h2>
<h5 style="color:royalblue;">Add your updated Resume to get notified by Recruiters</h5>
<form #ResumeForm="ngForm"
(ngSubmit)="submitResume(ResumeForm.value)">
<div class="form-group">
<label>Resume</label>
<input type="file" name="resume" id="resume" class="form-control">
</div>
<input value="submit" type="submit">
</form>
</div>
</div>
</div>
</div>
我的.ts文件在这里
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-candidate-reg-complete',
templateUrl: './candidate-reg-complete.component.html',
styleUrls: ['./candidate-reg-complete.component.css']
})
export class CandidateRegCompleteComponent implements OnInit {
constructor() { }
ngOnInit() {
}
submitResume=function(user){
console.log(user);
}
}
但控制台屏幕仅显示object{}
。没有显示表单内容。
我正在尝试输入文件。
任何人都可以帮助我吗?
提前致谢。
答案 0 :(得分:0)
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-candidate-reg-complete',
templateUrl: './candidate-reg-complete.component.html',
styleUrls: ['./candidate-reg-complete.component.css']
})
export class CandidateRegCompleteComponent implements OnInit {
constructor() { }
ngOnInit() {
}
submitResume(user){
console.log(user);
}
}
答案 1 :(得分:0)
将您的submitResume(value)
功能放在ngOnInit之外。它将从html中调用。
submitResume(value){
console.log(value);
}