Posts

Showing posts from 2021

arrays

  // remove same data from two arrays const array1 = this . Productsforcompare ; const array2 = this . Productsnewcompare2 ; const array3 = array1 . filter ( entry1 => ! array2 . some ( entry2 => entry1 . ProductID === entry2 . ProductId )); console . log ( array3 ); / / end remove same data from two arrays // remove single id based remove data from array const items = JSON . parse ( localStorage . getItem ( 'outbounddatasavedlocal' )); const filtered = items . filter ( item => item . OutboundId !== this . removeouterid ); localStorage . setItem ( 'outbounddatasavedlocal' , JSON . stringify ( filtered ));

filter array object names

   const sortBy = fn => {           const cmp = (a, b) => -(a < b) || +(a > b);           return (a, b) => cmp(fn(a), fn(b));         };                const CategoryName = o => o.CategoryName;         const CategoryName1 = sortBy(CategoryName);                 this.datapushnew3.sort(CategoryName1);         this.datapushnew4=this.datapushnew3;         console.log(this.datapushnew3.map(CategoryName));           console.log(this.datapushnew3 ,"this.datapushnew2.sort()");           }

ionic react project

how to create page in react ionic project create file add a name to that file add extension example Home.tsx Home.css .......... add routing to App.tsx              <Route exact path="/home">             <Home />           </Route> add above one in  <IonRouterOutlet>

update localstorage value

 var persons = JSON.parse(localStorage.persons); for (var i = 0; i < persons.length; i++) {    if(inputName === persons[i].name){  //look for match with name        persons[i].age += 2;  //add two        break;  //exit loop since you found the person    } } localStorage.setItem("persons", JSON.stringify(persons));

Api calling ionic4

import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core';   import { throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators';   constructor(private http: HttpClient) {       // development database     this.API_HOST= "";        }    OuterIdBreak(formdata) {           const reqHeader = new HttpHeaders();           reqHeader.append('Content-Type', 'application/json');       return this.http.post(`${this.API_HOST}/outbound/outeridbreak/`,formdata)       .pipe(map(res => res), catchError(this.errorHandler));     }  errorHandler(error: Response) {     console.log("RESULT:::", error);     return throwError(error);   }

facebook functionality in ionic5

Image
release key  keytool -exportcert -alias ssn -keystore /home/nssdt022/Sasi/Ionic/SSNFinalCode-09-03-2021/ssn.keystore | openssl sha1 -binary | openssl base64 debug key keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64

ionic 4 keyboard push content up (keyboard overlaps)

 /home/nssdt022/Sasi/Ionic/SSNFinalCode-09-03-2021/platforms/android/app/src/main/AndroidManifest.xml change below line to <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize "> change this part: android:windowSoftInputMode="adjustPan"

ionic scroll y-axis

 .data{     width: 100%;     height: 100%;      overflow-y: auto;      touch-action: pan-y !important;  }  ion-content{        --overflow:scroll;   }

how to split array as per fixed length, and ionic two dates differences in min,seconds,hours

this . forsasi -->array var perChunk = 5 // items per chunk var inputArray = this . forsasi ; this . result = inputArray . reduce (( resultArray , item , index ) => { const chunkIndex = Math . floor ( index / perChunk ); if (! resultArray [ chunkIndex ]) { resultArray [ chunkIndex ] = [] // start a new chunk } resultArray [ chunkIndex ]. push ( item ); return resultArray }, []) console . log ( this . result ); this . d1 = JSON . parse ( localStorage . getItem ( "starttime" )); var d2 = new Date ( this . d1 ); console . log ( d2 ) var date1 = new Date (); var Str1 = ( "00" + ( date1 . getMonth () + 1 )). slice (- 2 ) + "/" + ( "00" + date1 . getDate ()). slice (- 2 ) + "/" + date1 . getFullYear () + " " + ( "00" + date1 . getHours ()). slice (- 2 ) + ":" + ( "00" + date1 . getMinutes ()). slice (- 2 ) + "...