Having trouble with my template not displaying when the details are empty, but it shows up fine when there are values present. I'm stuck and unable to find a solution on my own. Can someone please offer some assistance?
<div class = "nopadding col-sm-12">
<form class="nobottommargin" [formGroup]="form" (ngSubmit)="onSubmit(form.value)" name="template-contactform">
<div class="col-sm-12 nopadding socialaddress">
<div class="col-sm-12 formpaddingcss">
<h3 class = "headingfontcss">SOCIAL ADDRESS</h3>
</div>
<div class="col-sm-12 formpaddingcss cardbackgroundcolor">
<div class="col-sm-7 cardtopbottompadding noleftpadding">
<div class="col-sm-12 nopadding">
<label for="template-contactform-name" class="col-sm-5 nopadding">FACEBOOK <small>*</small></label>
<div class="col-sm-7 nopadding text-right">
<span class="cardtextcolor" tooltip="Log in to your facebook account and click on your profile, copy and paste url from there" [tooltipDisabled]="false" [tooltipAnimation]="true"
tooltipPlacement="top"><i class="icon-question-sign"></i> What is my address?</span>
</div>
</div>
<div class="input-group divcenter">
<span class="input-group-addon noradius inputgroupaddon"><i class="icon-facebook"></i></span>
<input type="email" tooltip="Enter Facebook url" [tooltipDisabled]="false" [(ngModel)]="details.facebook" class="form-control required email formcontrolheight" placeholder="Facebook" aria-required="true">
</div>
</div>
</form>
My ts,
export class Social {
message: any;
http: Http;
details: IDetails[];
form: FormGroup;
constructor(fbld: FormBuilder, http: Http, private _service: GetAllList,public toastr: ToastsManager) {
this.http = http;
this._service.getList()
.subscribe(details => this.details = details);
}
Http call ts,
getList(): Observable<IDetails[]> {
// console.log(this.id);
return this._http.get(this._productUrl)
.map((response: Response) => {
if(response.json().error_code ==0){
return <IDetails[]>response.json().data[0];}
});
}
}