0

How to pass value from one component to another component but the condition is that we can not define the component on declaration section of module. i can easily pass value using this.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import {AddressModule}from './address/address.module';
import {AddressComponent}from './address/address.component';


@NgModule({
  declarations: [
    AppComponent,
    AddressComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

in address component i can easily retrieve the value using @Input but this is creating problem in my case.

so i want to do this using this

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import {AddressModule}from './address/address.module';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AddressModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

But i am not able to recieve value in component can somebody please suggest me some solution.

shubham paliwal
  • 27
  • 1
  • 10

0 Answers0