반응형

angular 13

Angular2에서 이벤트 이미터를 테스트할 방법이 있습니까?

Angular2에서 이벤트 이미터를 테스트할 방법이 있습니까? 이벤트 이미터를 사용하는 구성 요소가 있으며 페이지의 다른 사용자가 클릭하면 이벤트 이미터가 사용됩니다.단위 테스트 중에 이벤트 이미터를 관찰하고 TestComponentBuilder를 사용하여 EventEmitter.next() 메서드를 트리거하는 요소를 클릭하여 전송된 내용을 확인할 수 있는 방법이 있습니까?테스트는 다음과 같습니다. it('should emit on click', () => { const fixture = TestBed.createComponent(MyComponent); // spy on event emitter const component = fixture.componentInstance; spyOn(component..

programing 2023.05.12

ngFor(Angular 9) 내부의 동적 템플릿 참조 변수

ngFor(Angular 9) 내부의 동적 템플릿 참조 변수 내부에 동적 템플릿 참조 변수를 선언하는 방법ngFor요소? ng-bootstrap의 popover 구성 요소를 사용하고 싶은데, popover 코드(Html 바인딩 포함)는 다음과 같습니다. Hello, {{name}}! I've got markup and bindings in my popover! 그 요소들을 어떻게 안에 감쌀 수 있습니까?ngFor? Hello, {{member.name}}! I've got markup and bindings in my popover! 음... 무슨 생각이라도?템플릿 참조 변수는 정의된 템플릿으로 범위가 지정됩니다.구조적 지시사항은 중첩된 템플릿을 작성하므로 별도의 범위가 도입됩니다. 따라서 템플릿 참조에..

programing 2023.05.07

각도 2 검정:'input'의 알려진 속성이 아니므로 'ngModel'에 바인딩할 수 없습니다.

각도 2 검정:'input'의 알려진 속성이 아니므로 'ngModel'에 바인딩할 수 없습니다. 제어를 위해 각도 2 양방향 바인딩을 테스트하려고 합니다.input다음은 오류입니다. Can't bind to 'ngModel' since it isn't a known property of 'input'. app.component.html {{name}} app.component.ts @Component({ selector: 'app-root', templateUrl: './app.component.html' }) export class AppComponent implements OnInit { name: string; } app.component.spec.ts import { TestBed, async }..

programing 2023.05.07
반응형