Ionic 4 FAQ

Share the post
How to add rupee icon in Ionic 4 application?


Install font awesome dependency by the following command

npm install –save-dev @fortawesome/fontawesome-free

Go to angular.json & include the CSS file as shown below

 “styles”: [
              {
                “input”: “…”
              },
              {
                “input”: “src/global.scss”
              },
              {
                “input”: “node_modules/@fortawesome/fontawesome-free/css/all.css”
              }
            ],

then, use the rupee icon as follows

<ion-button  ><i class=”fas fa-rupee-sign”>10</i> Buy</ion-button>

How to add font awesome icons in Ionic 4 application?


Install font awesome dependency by the following command

npm install –save-dev @fortawesome/fontawesome-free

Go to angular.json & include the CSS file as shown below

 “styles”: [
              {
                “input”: “…”
              },
              {
                “input”: “src/global.scss”
              },
              {
                “input”: “node_modules/@fortawesome/fontawesome-free/css/all.css”
              }
            ],

then, use the rupee icon as follows

<ion-button  ><i class=”<ICON_NAME HERE>”></i> </ion-button>

How to push data in array in Ionic 4?


Please see the below example to add data in the array

HTML


 <ion-item>
    <ion-title>How to push data in array in Ionic 4?</ion-title>
    <ion-input type=”text” [(ngModel)]=”name”></ion-input>
  </ion-item>
  <ion-item>
    <ion-button (click)=”pushDataArray()”>Push data in array</ion-button>
    <div *ngFor=”let item of nameArray”>
      <ion-item *ngIf=”nameArray && nameArray.length”>
        <span>{{item}}</span>
      </ion-item>
    </div>
  </ion-item>


TS



 name: string = ”;
 nameArray: any = [];

constructor() { }

 pushDataArray() {
    this.nameArray.push(this.name);
    console.log(this.nameArray);
  }

1 thought on “Ionic 4 FAQ”

Leave a Comment