की ज्ञात संपत्ति नहीं है मेरे पास दो घटक हैं जो एक दूसरे का उपयोग करते हैं।कोणीय 2 परीक्षण - असफल: संकोच (वादे में): त्रुटि: टेम्पलेट पार्स त्रुटियां: 'संदेश' से बंधे नहीं जा सकते हैं क्योंकि यह
पहले एक है: "GamePanelComponent"
जो html फ़ाइल जिसमें है: "my-game-panel-output"
टैग
दूसरा एक है:
import { Component, Input } from '@angular/core';
@Component({
moduleId: module.id,
selector: 'my-game-panel-output',
templateUrl: 'gamepaneloutput.component.html',
styleUrls: [ 'gamepaneloutput.component.css' ]
})
export class GamePanelOutputComponent {
@Input()
message: string;
}
मैं एक परीक्षण लिखा GamePanelComponent
रहे हैं:
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { GamePanelComponent } from './gamepanel.component';
import { GamePanelOutputComponent } from '../gamepaneloutput/gamepaneloutput.component';
describe('GamePanelComponent (inline template)',() => {
let comp: GamePanelComponent;
let fixture: ComponentFixture<GamePanelComponent>;
beforeEach(async (() => {
TestBed.configureTestingModule({
declarations: [ GamePanelComponent ], // declare the test component
}).compileComponents()
.then(() => {
fixture = TestBed.createComponent(GamePanelComponent);
comp = fixture.componentInstance;
});
}));
it('isValidMove',() => {
comp.ngOnInit();
let isValid = comp.isValidMove(0,0);
expect(isValid).toBe(false);
});
});
दुर्भाग्यवश, परीक्षण इस त्रुटि के साथ विफल रहता है:
Failed: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'message' since it isn't a known property of 'my-game-panel-output'.
जैसा कि आप देख सकते हैं कि मैंने "GamePanelOutputComponent
" आयात करने का प्रयास किया है और इससे मदद नहीं मिलती है।
मैं वास्तव में इस पर अटक गया हूं। क्या कोई सहायता कर सकता है?
आप आगे जब मैं आयात करने के लिए और जब सिर्फ एक घोषणा जोड़ने की जरूरत है व्याख्या कर सकते हैं? – ohadinho
मैंने जवाब अपडेट किया। क्या यह अब आपके लिए अधिक स्पष्ट है? –
क्या आप मुझे बता सकते हैं कि GamePanelOutputComponent कस्टम HTML तत्व का उपयोग करने के लिए मुझे गेमपेनल कॉम्पोनेंट के अंदर कुछ भी घोषित करने की आवश्यकता क्यों नहीं है, लेकिन इसके लिए एक परीक्षण लिखने के लिए मुझे GamePanelOutputComponent आयात करने की आवश्यकता है? – ohadinho