{
"name": "my-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.4.5",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/router": "^4.2.4",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "^5.4.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.4",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.3.3"
}
}
web.service.ts文件中的代码是: -
async getData(daOne){
try {
daOne=(daOne) ? '/' + daOne: '';
var response = await this.http.get(this.HOME_URL+'/MyPage'+daOne).toPromise();
this.news = response.json();
}
我的组件中的代码: -
ngOnInit() {
var data=this.route.snapshot.params.name;
this.webService.getData(data);
}
那么这是我的代码,当我试图执行此操作然后它向我显示我在标题中指定的错误...我在谷歌搜索但无法解决此错误...所以请任何人帮助我来解决这个错误...
答案 0 :(得分:0)
这实际上是一个问题,模板中的函数调用与它试图在组件的TypeScript中调用的函数的参数列表不匹配。检查模板中的方法调用并验证参数是否正确。
例如:
模板:
<button onClick="clickHandler()">Click this!</button>
打字稿:clickHandler(event) { ... }