Friday, December 22, 2017

How to call a function from html with *ngIf condition - IONIC 2

Try this code
home.ts
@Component({
  selector: 'my-page',
  templateUrl: 'home.html',
})
export class MyPage {
  myDate:any;

   // function you call when u select date
   setDate(){
      this.myDate="2017-12-22";
   }
}

home.html
<ion-list>
<ion-item text-wrap *ngIf="myDate" style="border-radius:7px 0px 10px 7px;box-shadow: 3px 3px 3px #ececec;">
  You selected {{myDate}} as your target date.
</ion-item>
</ion-list>


0 comments:

Post a Comment