【发布时间】:2018-01-18 18:19:37
【问题描述】:
我正在使用什么
- 角度
我要做什么
- 运行 ng build -prod 命令
会发生什么
- 我收到以下错误:
提供的参数与调用目标的任何签名都不匹配。
- 运行 'ng build --watch' 时不存在此错误
我的尝试
- 我删除了一些 HTML,其中包括一个提交按钮,用于将一些值传递给我的组件打字稿文件中的函数。当我这样做时,构建命令工作正常。
组件 HTML
下面是导致问题的 HTML sn-p。我正在从输入字段中获取值并将它们推送到函数中。运行“ng build -watch”时,我没有任何问题,一切正常。只有在“prod”命令上,我才会在终端中收到错误
<div class="vs__details__actions">
<button class="vs__button"
[disabled]="!selectedFiles"
(click)="submitForm(newTitle.value, newReference.value, newDate.value, newAuditorName.value, newCompanyName.value); newTitle.value='';
newReference.value=''; newDate.value=''; newAuditorName.value=''; newCompanyName.value=''">
Add
</button>
</div>
组件 Typescript 文件
import { Component, OnInit } from '@angular/core';
import { ProjectsAddService } from './projects-add.service';
import { Upload } from './upload';
import * as _ from "lodash";
@Component({
selector: 'upload-form',
templateUrl: './projects-add.component.html',
styleUrls: ['./projects-add.component.css']
})
export class ProjectsAddComponent {
selectedFiles: FileList;
currentUpload: Upload;
constructor(private upSvc: ProjectsAddService) { }
detectFiles(event) {
this.selectedFiles = event.target.files;
}
uploadSingle() {
let file = this.selectedFiles.item(0)
this.currentUpload = new Upload(file);
}
submitForm(title: string, reference: string, date: string, auditorName: string, newCompanyName: string, upload: Upload) {
let file = this.selectedFiles.item(0)
this.currentUpload = new Upload(file);
this.upSvc.submitForm(title, reference, date, auditorName, newCompanyName, this.currentUpload);
}
}
任何帮助将不胜感激:)
【问题讨论】:
-
什么是(点击)功能?你检查过压痕吗?这是一个错字还是真的是这样?
-
点击是我将新输入值传递给component.ts中的函数的方式。至于缩进,那是stackoverflow。我不能把它整齐地挤进去......
标签: angular typescript angular2-aot