angular - How can i pass Data from component to component using @Input -


here have 2 components dummycomponent , logincomponent wana 2 pass data login dummy

dummycomponent.ts

@component({     selector: "dummy-selector",     template: `<div>     <p>this dummy</p>     <input type="text" value="{{sampledata}}"  ([ngmodel])="sampledata" /> </div>` }) export class dummycomponent {     @input() incommingdata: string; 

logincomponent

export class logincomponent {     sampledata: string = "login components..."; 

logincomponent.html here nedd pass sampledata logincomponent dummycomponent

 <div>         <input type="text"  value="{{ sampledata }}" [(ngmodel)]='sampledata'>         <b>data child</b>              <dummy-selector [incommingdata]="sampledata" (childdata)='handleevent($event)' [(ngmodel)]="sampledata">                  </dummy-selector>     </div> 

in dummycomponent should bind incommingdata not sampledata

@component({     selector: "dummy-selector",     template: `<div>     <p>this dummy</p>     <span>{{incommingdata}}</span>     <input type="text" [(ngmodel)]="incommingdata" /> </div>` }) 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -