मेरा कोणीय प्रोजेक्ट बढ़ रहा है इसलिए मैं अपनी परियोजना को साफ रखना चाहता हूं।मॉड्यूल के माध्यम से एकाधिक कोणीय घटकों को आयात करें
मेरे पास एक कोणीय घटक है जो घोंसला वाले कोणीय घटक पर निर्भर करता है।
अब मुझे इन घटकों का उपयोग करने के लिए दो आयात विवरणों की आवश्यकता है जो एक दूसरे के बिना काम नहीं कर सकते हैं।
एक समाधान के रूप में मैं एक छोटा कोणीय मॉड्यूल बनाना चाहता था जिसमें इन दो घटक शामिल हैं और मॉड्यूल को मेरे मुख्य app.module में आयात करें।
ऐसा करने के बाद मुझे एक त्रुटि मिलती है जिसमें कहा गया है कि छोटे मॉड्यूल के अंदर घटकों में से एक को पहचाना नहीं गया है।
//app.module.ts
@NgModule({
imports: [BrowserModule, HttpModule, DictaatModule],
declarations: [AppComponent, DictatenComponent, FilePreviewComponent],
bootstrap: [AppComponent]
})
//Dictaat.module.ts
import { DictaatComponent } from './dictaat.component';
import { DictaatEntryComponent } from './dictaat-entry.component';
@NgModule({
imports: [BrowserModule, HttpModule],
declarations: [DictaatComponent, DictaatEntryComponent],
})
export class DictaatModule{ }
मेरा प्रश्न: यह एक मॉड्यूल में समूह से कई घटकों के लिए एक अच्छा अभ्यास है और यह पहले से ही कोणीय में समर्थित है?
ps। मैं कोणीय 2.0.0 के साथ काम कर रहा हूं, आरसी के नहीं। मेरा सेटअप नायकों ट्यूटोरियल के दौरे के सेटअप के लिए तुलनीय है।
संपादित करें: स्रोत कोड https://github.com/Linksonder/Webdictaat/
त्रुटि संदेश:
Unhandled Promise rejection: Template parse errors:
Can't bind to 'dictaatName' since it isn't a known property of 'wd-dictaat'.
1. If 'wd-dictaat' is an Angular component and it has 'dictaatName' input, then verify that it is part of this module.
2. If 'wd-dictaat' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
("
</div>
<div class="col-md-3">
<wd-dictaat [ERROR ->][dictaatName]="selectedDictaat.name" *ngIf="selectedDictaat">Loading dictaat...</wd-dictaat>
</d"): [email protected]:20
'wd-dictaat' is not a known element:
1. If 'wd-dictaat' is an Angular component, then verify that it is part of this module.
2. If 'wd-dictaat' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
</div>
<div class="col-md-3">
[ERROR ->]<wd-dictaat [dictaatName]="selectedDictaat.name" *ngIf="selectedDictaat">Loading dictaat...</wd-dicta"): [email protected]:8 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
Can't bind to 'dictaatName' since it isn't a known property of 'wd-dictaat'.
1. If 'wd-dictaat' is an Angular component and it has 'dictaatName' input, then verify that it is part of this module.
2. If 'wd-dictaat' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message.
("
</div>
<div class="col-md-3">
<wd-dictaat [ERROR ->][dictaatName]="selectedDictaat.name" *ngIf="selectedDictaat">Loading dictaat...</wd-dictaat>
</d"): [email protected]:20
'wd-dictaat' is not a known element:
1. If 'wd-dictaat' is an Angular component, then verify that it is part of this module.
2. If 'wd-dictaat' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
</div>
<div class="col-md-3">
[ERROR ->]<wd-dictaat [dictaatName]="selectedDictaat.name" *ngIf="selectedDictaat">Loading dictaat...</wd-dicta"): [email protected]:8
at TemplateParser.parse (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:8530:21)
at RuntimeCompiler._compileTemplate (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16905:53)
at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:85)
at Set.forEach (native)
at compile (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:49)
at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:192:28)
at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:85:43)
at http://localhost:3000/node_modules/zone.js/dist/zone.js:451:57
at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:225:37)
at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:125:47)
त्रुटि संदेश पोस्ट कृपया। – mxii