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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -