Hi
I am trying to update the child component input field as shown below
*Child Component --> Template*
> <div class="col-md-6">
> <!--SubmissionDate -->
> <label style="width: 150px" class="control-label"
> for="SubmissionDate">
> Submission Date
> </label>
> <input style= "width: 400px" readonly type= "text"
> class="form-control" id= "SubmissionDate" name= "SubmissionDate" required
> *[(ngModel)]="modelTop.SubmissionDate"* #SubmissionDate = "ngModel" >
> <div *ngIf="SubmissionDate.errors && (SubmissionDate.dirty ||
> SubmissionDate.touched)">
> <p *ngIf="SubmissionDate.errors.required" class="alert
> alert-danger">
> The Submission Date is required.
> </p>
> </div>
> </div>
> </div>
> <br/>
> *{{title}}*
*Child Component *
>
> *@Input() title: string;*
> ngOnInit() {
> * this.modelTop.SubmissionDate = this.title;*
> }
the {{title}} in the template above gets updated after simple assignment
from parent component and then changes value after http service call in
parent.
But the *[(ngModel)]="modelTop.SubmissionDate" only *gets updated after
simple assignment from parent component and then doesn't changes value
after http service call in parent.
Parent Component
*Template*
<topSection-Component [title]="childTitle" ></topSection-Component>
*Service Call in constructor*
* this.childTitle = 'ABC';*
this.http.get(this._urlMyPropsWS, { headers: header })
.map(res => res.json())
.subscribe(propsData => {
this.http.get(this._urlGroupWS, { headers: header })
.map(res => res.json())
.subscribe(userGroupData => {
this.http.get(this._urlListWS, { headers: header })
.map(res => res.json())
.subscribe(listData => {
*this.childTitle = 'XYZ;*
})
})
});
Please help!
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.