Search Posts

Category: ionic3

How retrive a value from JSON object sent by server in Ionic 3

So basically I’m requesting a post request to the server which in return, send a token in JSON object in this form: { token: “eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjIyLCJpc3MiOiJodHRwczovL2hvYnVkZGllcy5jb20vYXBpL2F1dGgvbG9naW5fYXBpIiwiaWF0IjoxNTE3MzkwNTkwLCJleHAiOjE1MTczOTQxOTAsIm5iZiI6MTUxNzM5MDU5MCwianRpIjoiWUxtdXJ5TkV2UzlwSEExTyJ9.nWV7OWLYdMJmZCHNP9tFuAmZ84DwzYO00O3jQ_RfhXQ” } What I required is to append that token with the apiUrl to get the appropriate information of a user currently logged in. The server is returning this JSON object in a variable “result” as shown below: // for login the user in the app. loginUser() { //values from the […]

Add margin/focus to a button if a keyboard is showen on ionic3

What I want to achieve is to either focus or alternatively add a bottom margin to a button after I click on an ion-input and the keyboard shows up, why I am doing this is because the keyboard is covering the button, and the button is actually under the ion-input, which means i will need to scroll the page up after my input. what i have achieved currently is this: page.ts export class TestPage { […]

Ionic 3 How to use NavController#setRoot() in a Ionic Storage promise [duplicate]

This question already has an answer here: When should I use Arrow functions in ECMAScript 6? 7 answers What I want to implement is that after a user chooses the default language, the setting is stored in IonicStorageModule, then after the promise done, redirect to the tutorial page. I have a code like this: //… import { Storage } from ‘@ionic/storage’; //.. export class LanguageSetPage { constructor(private translate: TranslateService, private storage: Storage, public navCtrl: NavController) […]

ionic 3 read stored value native storage in function ionViewDidLoad ()

I’m having a problem, I’d like to read a value saved in the Native Storage Cordova plugin in the function -> ionViewDidLoad (). Description of the function: ionViewDidLoad () = “Runs when the page has loaded. This event only happens once per page being created. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The ionViewDidLoad event is good place to put your setup code for […]

Common Toast Module for all HTTP calls – Ionic 3

Hi I am unable to understand how to make a common module so for example here am taking an example of only Toast Module. So, within app, I have created a common module – CommonRestProvider which is extending http – get post put etc From my services I am calling this module’s get/post calls in which I want to show a toast after success. It’s constructor looks like this.. constructor(protected http: Http, public loading: LoadingController, […]

compiler.compileModuleAndAllComponentsAsync is taking more time to compile component having (Long Template HTML) and load the component

I am attempting to load a template(HTML) from server dynamically at runtime , render it and bind to Ionic page . i am using a dynamic method to create a component dynamically function createDynamicComponent(html) and passing html to it and keeping html code as template to the dynamic component getdata(url){ let instance=this; this.http.get(url) .subscribe((data:any) => { // debugger; // this.binddata(data._body); console.log(data._body); this.compiler.clearCache() this.compiler.compileModuleAndAllComponentsAsync(createDynamicComponent(data._body)) .then((mwcf: ModuleWithComponentFactories<any>) => { let factory: ComponentFactory<any> = mwcf.componentFactories.find(cf => cf.componentType.name === […]

Next Page »