परीक्षण करते समय आप बच्चे के घटक का नकल कैसे करते हैं?चाकिंग बाल घटक - कोणीय 2
<section id="selected-container" class="container-fluid">
<hr/>
<product-settings></product-settings>
<product-editor></product-editor>
<product-options></product-options>
</section>
और घटक घोषणा इस तरह दिखता है:
import { Component, Input } from '@angular/core';
import { ProductSettingsComponent } from '../settings/product-settings.component';
import { ProductEditorComponent } from '../editor/product-editor.component';
import { ProductOptionsComponent } from '../options/product-options.component';
@Component({
selector: 'product-selected',
templateUrl: './product-selected.component.html',
styleUrls: ['./product-selected.component.scss']
})
export class ProductSelectedComponent {}
इस घटक वास्तव में अन्य घटकों में रहते हैं और करने के लिए सिर्फ एक जगह है मैं एक माता पिता के घटक कहा जाता product-selected
जिसका टेम्पलेट इस तरह दिखता है शायद कोई अन्य कार्य नहीं होगा।
Error: Template parse errors:
'product-editor' is not a known element:
1. If 'product-editor' is an Angular component, then verify that it is part of this module.
2. If 'product-editor' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
<hr/>
<product-settings></product-settings>
[ERROR ->]<product-editor></product-editor>
मैं बच्चे के घटकों का एक मज़ाक उड़ाया संस्करण लोड करने के लिए कोशिश की है, लेकिन पता नहीं कैसे:
लेकिन जब मैं परीक्षण मैं निम्नलिखित टेम्पलेट त्रुटि मिलती है की स्थापना की, सभी तीन घटकों के लिए बार-बार करने के लिए - मैंने जो उदाहरण देखा है, वे केवल माता-पिता को ओवरराइड करते हैं और बाल घटकों का भी उल्लेख नहीं करते हैं। तो मैं इसे करने के बारे में कैसे जा सकता हूँ?
आप जानते हैं कि मैं पर्यवेक्षण परीक्षण में देखने के लिए उस परीक्षण पृष्ठ पर था और उस हिस्से को कभी नहीं देखा। धन्यवाद - यह एक अच्छा पढ़ा गया था, हालांकि मेरी इच्छा है कि मुझे पहले मिल गया था !! अपने उत्तर को स्वीकार करना क्योंकि यह – Katana24
से बहुत आसान है, यह वास्तव में एक खराब समाधान है क्योंकि यह अन्य संभावित मुद्दों को अस्पष्ट करता है और इसलिए परीक्षण कोड के उद्देश्य के विपरीत है। अर्नुद पी ने एक अच्छा जवाब दिया। – user5080246