이라는 제목의 새 문자열을 .next()로 마침표으로 푸시하려고하는데 콘솔에서 this.period.next가 아닙니다. 함수 오류.각도 5 : 제목의 .next()가 함수가 아닙니다
option.component.ts
import { Component, OnInit } from '@angular/core';
import { Subject } from 'rxjs';
@Component({
selector: 'app-option',
templateUrl: './option.component.html'
})
export class OptionComponent implements OnInit {
public period: Subject<string> = new Subject<string>();
constructor() {}
ngOnInit() {}
setPeriod(period: string) {
this.period.next(period);
}
}
option.component.html
<mat-radio-group [(ngModel)]="period" (ngModelChange)="setPeriod($event)">
<span *ngFor="let option of httpHeader.option"><mat-radio-button [checked]="option.default" [value]="option.param" >{{ option.desc }}</mat-radio-button><br /></span>
</mat-radio-group>
나는 rxjs 5.5.2을 실행하는거야. 사용자가 라디오 버튼을 선택하면 setPeriod 함수가 트리거됩니다.
내가 뭘 잘못하고 있니? 나는 HTTP 서비스에서 같은 메소드를 사용하지만 작동하지만이 컴포넌트에서는 그렇지 않다. 각도 2/4에서
'setPeriod'는 어떻게 호출됩니까? 템플릿 표시. – dfsq
템플릿을 추가했습니다. 참고 : .ts 파일은 삭제 된 버전입니다 – Rogier
'[((ngModel)] = "기간"이 (가) 귀하의 주제를 덮어 씁니다. 라디오 그룹에 주제를 지정하여 무엇을하려고합니까? – LLai