Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
613 views
in Technique[技术] by (71.8m points)

module - Angular 10 use a component inside an other (error : is not a known element)

I am encountering a problem. I'm starting an application with Angular 11. I'm trying to create a resister page: signup.

  • I created a module "users" which will contain every module about user (signup, signin, info...)
  • Inside the users module, I created a module signup which will contain every module for the register page (some information, forms...)
  • Inside signup module, I created 2 components : SignupComponent (=some informations) and FormSignUpComponent (=form register).

when I lunch the app I get this error message :

'i-form-sign-up' is not a known element:
1. If 'i-form-sign-up' is an Angular component, then verify that it is part of this module.
2. If 'i-form-sign-up' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

However, FormSignUpComponent is declared inside SignupModule :/

Can you help me ?

I have this hierarchy :

https://candyss.fr/img/i-1.png

SignupModule :

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { SignupComponent } from './signup.component';
import { UiModule } from '../../core/ui/ui.module';
import { FormSignUpComponent } from './form-sign-up/form-sign-up.component';

@NgModule({
  declarations: [
    SignupComponent,
    FormSignUpComponent
  ],
  imports: [
    CommonModule,
    UiModule
  ]
})
export class SignupModule { }

SignUp.component.html :

<div class="form-container">
    <i-form-sign-up></i-form-sign-up>
    <section>
        ... some informations
    </section>
</div>

FomSignUpComponent :

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'i-form-sign-up',
  templateUrl: './form-sign-up.component.html',
  styleUrls: ['./form-sign-up.component.css']
})
export class FormSignUpComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }
}
question from:https://stackoverflow.com/questions/65601653/angular-10-use-a-component-inside-an-other-error-is-not-a-known-element

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to reply this article.

OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...