我是一名有用的助手,可以为你翻译文本。
此外,如果我简单地省略
我遵循这个教程,但仍然出现了类型错误:“期望 0 个类型参数,但得到了 1 个”。 https://youtu.be/I317BhehZKM?t=57s
我已经指定了:
newUserInfoComplete:boolean = false
但是在这一行中,<boolean>
出现了上述错误:
@Output() newUserInfoCompleteEvent = new EventEmitter <boolean> ();
此外,如果我简单地省略
<boolean>
,就会出现以下错误:Argument of type 'boolean' is not assignable to parameter of type 'string'.
这里下划线标出了 this.NewUserInfoComplete:
this.newUserInfoCompleteEvent.emit(this.newUserInfoComplete);
这是我的组件:
import { Component, OnInit, Output } from '@angular/core';
import { slideToRight } from '../../../../router.animations';
import { Router, ActivatedRoute, UrlSegment } from '@angular/router';
import { EventEmitter } from 'protractor';
@Component({
selector: 'app-new-user-input',
templateUrl: './new-user-input.component.html',
styleUrls: ['./new-user-input.component.css'],
animations: [slideToRight()]
})
export class NewUserInputComponent implements OnInit {
newUserInfoComplete:boolean = false
@Output() newUserInfoCompleteEvent = new EventEmitter <boolean> ();
constructor(private router: Router, r: ActivatedRoute) {
r.url.subscribe((s: UrlSegment[]) => {
console.log("url", s); //https://vsavkin.com/angular-router-understanding-router-state-7b5b95a12eab
});
}
ngOnInit() {
}
sendNewUserInfoComplete(){
this.newUserInfoCompleteEvent.emit(this.newUserInfoComplete);
}
displaySibling() {
console.log(this.router);
this.router.navigate(['../', { outlets: { newuserorginfo: ['newuserorginfo'] } }])
}
closeBlade() {
this.router.navigate([{ outlets: { newuserinput: null } }]);
}
}