Reusable component is not working in angular
up vote
1
down vote
favorite
My project folder structure is like below
I trying to use reusable component in my module. For that I'm using products component inside login component but it showing like below
app-products' is not a known element:
1. If 'app-products' is an Angular component, then verify that it is part of this module.
2. If 'app-products' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
And my home.module.ts is like below
imports: [
CommonModule,
RouterModule.forChild(HomeRoutingModule),
],
declarations: [UserProfileComponent,ProductsComponent],
exports:[ProductsComponent]
})
could any one please help in this regard how to solve this error
angular typescript
add a comment |
up vote
1
down vote
favorite
My project folder structure is like below
I trying to use reusable component in my module. For that I'm using products component inside login component but it showing like below
app-products' is not a known element:
1. If 'app-products' is an Angular component, then verify that it is part of this module.
2. If 'app-products' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
And my home.module.ts is like below
imports: [
CommonModule,
RouterModule.forChild(HomeRoutingModule),
],
declarations: [UserProfileComponent,ProductsComponent],
exports:[ProductsComponent]
})
could any one please help in this regard how to solve this error
angular typescript
which Module the login component is declared in ?
– Sunil Singh
2 days ago
app.module.ts consisting
– change need
2 days ago
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
My project folder structure is like below
I trying to use reusable component in my module. For that I'm using products component inside login component but it showing like below
app-products' is not a known element:
1. If 'app-products' is an Angular component, then verify that it is part of this module.
2. If 'app-products' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
And my home.module.ts is like below
imports: [
CommonModule,
RouterModule.forChild(HomeRoutingModule),
],
declarations: [UserProfileComponent,ProductsComponent],
exports:[ProductsComponent]
})
could any one please help in this regard how to solve this error
angular typescript
My project folder structure is like below
I trying to use reusable component in my module. For that I'm using products component inside login component but it showing like below
app-products' is not a known element:
1. If 'app-products' is an Angular component, then verify that it is part of this module.
2. If 'app-products' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
And my home.module.ts is like below
imports: [
CommonModule,
RouterModule.forChild(HomeRoutingModule),
],
declarations: [UserProfileComponent,ProductsComponent],
exports:[ProductsComponent]
})
could any one please help in this regard how to solve this error
angular typescript
angular typescript
edited 2 days ago
asked 2 days ago
change need
807
807
which Module the login component is declared in ?
– Sunil Singh
2 days ago
app.module.ts consisting
– change need
2 days ago
add a comment |
which Module the login component is declared in ?
– Sunil Singh
2 days ago
app.module.ts consisting
– change need
2 days ago
which Module the login component is declared in ?
– Sunil Singh
2 days ago
which Module the login component is declared in ?
– Sunil Singh
2 days ago
app.module.ts consisting
– change need
2 days ago
app.module.ts consisting
– change need
2 days ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
Either you import
HomeModule
inAppModule
or you must declare theLogin Component
inHomeModule
.
imports: [
HomeModule
],
declarations:
})
export class AppModule
add a comment |
up vote
0
down vote
Home module seems to be a common module not a root module - so if you want to use components
or directive
from that module you need to export those components - you have done correctly
Finally - angular will run on the root module you need to make sure that you are going to use this module in your application - so just import HomeModule
in your AppModule
imports: [
HomeModule
],
declarations:
})
export class AppModule
This will stop lazy loading on HomeModule
- to achieve lazy just bind components from common module by routing - hope this helps - Thanks happy coding !!
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Either you import
HomeModule
inAppModule
or you must declare theLogin Component
inHomeModule
.
imports: [
HomeModule
],
declarations:
})
export class AppModule
add a comment |
up vote
2
down vote
Either you import
HomeModule
inAppModule
or you must declare theLogin Component
inHomeModule
.
imports: [
HomeModule
],
declarations:
})
export class AppModule
add a comment |
up vote
2
down vote
up vote
2
down vote
Either you import
HomeModule
inAppModule
or you must declare theLogin Component
inHomeModule
.
imports: [
HomeModule
],
declarations:
})
export class AppModule
Either you import
HomeModule
inAppModule
or you must declare theLogin Component
inHomeModule
.
imports: [
HomeModule
],
declarations:
})
export class AppModule
edited 2 days ago
answered 2 days ago
Sunil Singh
4,5941624
4,5941624
add a comment |
add a comment |
up vote
0
down vote
Home module seems to be a common module not a root module - so if you want to use components
or directive
from that module you need to export those components - you have done correctly
Finally - angular will run on the root module you need to make sure that you are going to use this module in your application - so just import HomeModule
in your AppModule
imports: [
HomeModule
],
declarations:
})
export class AppModule
This will stop lazy loading on HomeModule
- to achieve lazy just bind components from common module by routing - hope this helps - Thanks happy coding !!
add a comment |
up vote
0
down vote
Home module seems to be a common module not a root module - so if you want to use components
or directive
from that module you need to export those components - you have done correctly
Finally - angular will run on the root module you need to make sure that you are going to use this module in your application - so just import HomeModule
in your AppModule
imports: [
HomeModule
],
declarations:
})
export class AppModule
This will stop lazy loading on HomeModule
- to achieve lazy just bind components from common module by routing - hope this helps - Thanks happy coding !!
add a comment |
up vote
0
down vote
up vote
0
down vote
Home module seems to be a common module not a root module - so if you want to use components
or directive
from that module you need to export those components - you have done correctly
Finally - angular will run on the root module you need to make sure that you are going to use this module in your application - so just import HomeModule
in your AppModule
imports: [
HomeModule
],
declarations:
})
export class AppModule
This will stop lazy loading on HomeModule
- to achieve lazy just bind components from common module by routing - hope this helps - Thanks happy coding !!
Home module seems to be a common module not a root module - so if you want to use components
or directive
from that module you need to export those components - you have done correctly
Finally - angular will run on the root module you need to make sure that you are going to use this module in your application - so just import HomeModule
in your AppModule
imports: [
HomeModule
],
declarations:
})
export class AppModule
This will stop lazy loading on HomeModule
- to achieve lazy just bind components from common module by routing - hope this helps - Thanks happy coding !!
answered 2 days ago
Rahul Swamynathan
62016
62016
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238588%2freusable-component-is-not-working-in-angular%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
which Module the login component is declared in ?
– Sunil Singh
2 days ago
app.module.ts consisting
– change need
2 days ago