您好我在使用AoT编译Angular2项目时遇到了问题。
我参考了Angular2 Cookbook here。
但是它吐出了大量的错误。我做错了什么?
这些是我得到的错误。
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:1380:101: Supplied parameters do not match any si
gnature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:1384:101: Supplied parameters do not match any si
gnature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:1388:101: Supplied parameters do not match any si
gnature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:1834:100: Supplied parameters do not match any si
gnature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:2155:52: Supplied parameters do not match any sig
nature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:2173:52: Supplied parameters do not match any sig
nature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-detail.component.ngfactory.ts:2241:48: Property 'toggled' does not exist on typ
e 'TeacherDetailComponent'.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-childviews/teacher-childview1.component.ngfactory.ts:256:100: Supplied paramete
rs do not match any signature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-childviews/teacher-childview1.component.ngfactory.ts:999:52: Supplied parameter
s do not match any signature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-childviews/teacher-childview3.component.ngfactory.ts:535:100: Supplied paramete
rs do not match any signature of call target.
Error at /Users/yoo/match-mAngular2/aot/src/app/pres/teacher-list/teacher-detail/tea
cher-childviews/teacher-childview3.component.ngfactory.ts:733:52: Supplied parameter
s do not match any signature of call target.
错误示例
const currVal_2_0_0:any = valUnwrapper.unwrap(this._pipe_slice_0.transform(valUnwrapper.unwrap(import3.castByValue(this._pipe_keyValues_2_1,(<View_TeacherChildviewThreeComponent0>this.parentView)._pipe_keyValues_2.transform)(this.context.$implicit.value['introduceInfo'])),12,13));
这是编译文件错误,似乎这是由html模板中的这一行引起的
<div *ngFor="let epi of detail.value['introduceInfo']|keyValues|slice:12:13">
我的teacehr细节组件
@Component({
moduleId: module.id,
selector: 'teacher-detail',
templateUrl: 'teacher-detail.component.html',
styleUrls: ['teacher-detail.component.css']
})
export class TeacherDetailComponent implements OnInit {
@ViewChild('childModal') public childModal: ModalDirective;
currentUser: User;
private errorMessage: any;
teaInfo: any[];
constructor(
private route: Router,
private teaDetail: TeacherDetailService,
private getQueryVal: TeacherDetailPassDataService,
private requestQuery: TutorRequestComponent,
private auth: AuthenticationService,
) {
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
}
getVal1() {
return this.getQueryVal.passQueryVal1()
}
//area
getVal2() {
return this.getQueryVal.passQueryVal2()
}
//grade
getVal3() {
return this.getQueryVal.passQueryVal3()
}
//subject
getTeacherDetail(): void {
let params = new URLSearchParams();
params.set('gradeType', `${this.getVal2()}`)
params.set('subjectType', `${this.getVal3()}`)
params.set('district', `${this.getVal1()}`)
this.teaDetail.getTeachersDetail(params)
.subscribe
(
teaInfo => this.teaInfo = teaInfo,
error => this.errorMessage = error
)
}
public hideChildModal(): void {
this.childModal.hide();
}
public isCollapsed: boolean = true;
public collapsed(event: any): void {
console.log(event);
}
public expanded(event: any): void {
console.log(event);
}
deepTeaInfo: Object = {};
getdeep_detailInfo(): void {
let params = new URLSearchParams();
params.set('gradeType', `${this.getVal2()}`)
params.set('subjectType', `${this.getVal3()}`)
params.set('district', `${this.getVal1()}`)
this.teaDetail.getDetailInfo(params)
.subscribe
(
data => {
this.deepTeaInfo = data;
error => this.errorMessage = error
})
}
val1: string;
val2: string;
val3: string;
passParams() {
this.val1 = this.getVal2();
this.val2 = this.getVal3();
this.val3 = this.getVal1();
this.requestQuery.passParams_request(this.val1, this.val2, this.val3);
}
ngOnInit(): void {
this.getTeacherDetail();
this.getVal1();
this.getVal2();
this.getVal3();
this.getdeep_detailInfo();
this.passParams();
}
onClick(charge, perWeek, perMinutes) {
if (this.currentUser['data']['memberType'] == 'Parent') {
this.route.navigate(['../request']);
this.getQueryVal.setChargeValue(charge);
this.getQueryVal.setLecutrePerWeek(perWeek);
this.getQueryVal.setMinutesPerLecture(perMinutes);
}
else if (this.currentUser['data']['memberType'] == 'Student') {
this.route.navigate(['../request']);
this.getQueryVal.setChargeValue(charge);
this.getQueryVal.setLecutrePerWeek(perWeek);
this.getQueryVal.setMinutesPerLecture(perMinutes);
}
else if (this.currentUser['data']['memberType'] == 'Admin') {
this.route.navigate(['../request']);
this.getQueryVal.setChargeValue(charge);
this.getQueryVal.setLecutrePerWeek(perWeek);
this.getQueryVal.setMinutesPerLecture(perMinutes);
}
else if (this.currentUser['data']['memberType'] == 'Teacher') {
this.childModal.show();
}
}
showModal(){
this.route.navigate(['../afterLogin']);
}
onLogout() {
this.route.navigate(['../login']);
this.auth.logout();
}
}
三江源