Search Posts

Category: ionic2

file url to data uri convertion

I am getting file url from server through http.post request. I need to convert image to base64 string for database storage. I got solution using angular for ionic 2+ application convertToDataURLviaCanvas(url, outputFormat){ return new Promise( (resolve, reject) => { let img = new Image(); img.crossOrigin = ‘Anonymous’; img.onload = function(){ let canvas = <HTMLCanvasElement> document.createElement(‘CANVAS’), ctx = canvas.getContext(‘2d’), dataURL; canvas.height = this.height; canvas.width = this.width; ctx.drawImage(this, 0, 0); dataURL = canvas.toDataURL(outputFormat); //callback(dataURL); canvas = null; […]

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 { […]

slide right to delete not persistently deleting the item ( The delete works but the item deleted reappears on closing the app and opening it again)

I am displaying a list of news headlines in my app. It has a view button to view the news item and on slide right a cross sign emerges, on clicking which the news item gets deleted. It is as shown in the picture News item delete picture But the deleted news item reappears on closing and opening the app again. This is the news code (both Typescript and HTML) where delete(x) is there – […]

Ionic "Unexpected value ‘undefined’ declared by the module ‘AppModule’"

I made some minor changes to one of my views in my application, and am now getting a fatal error as seen below: Unexpected value ‘undefined’ declared by the module ‘AppModule’ I have checked for cyclical references, and issues in the app.module but have been able to see anything that would be causing the issue. Below are the functions of the classes that changed since the crash Below is my medHist: populatePage(id){ console.log(“single-test populate page […]

How to run html page continuously when data is available in array ionic2 framework

I’m implementing graphs. If a user wants to see the list of graphs i have to display it. So when ever data is available in array it should take and print on html. How do I run html continuously? userpage.html <div *ngFor=”let CardGraph of DisplayCardIDList”> <ion-card class=”graphCard” > <div class=”IntrestGraph” *ngIf = “CardGraph.CardType == 2”> <canvas id ={{CardGraph.CardID}}></canvas> </div> </ion-card> </div> Source: AngularJS

Ionic tabs switching from one tab to another tab two events need to switch

I’ve Ionic project have 2 tabs. When I switch from Tab1 to Tab2 using $state.go, the Tab2 page is empty, again when I pressed Tab2, Then only I can view Tab2 detail. How to clear existing view in Tab2(Only Tab2 Ionic view clear) and show Tab2 view without again pressing Tab2. My code is Tab2 code in app.js .state(‘tabs.chart’, { url: ‘/chart’, params: {‘chartsymbol’: null}, views: { ‘chart-tab’: { templateUrl: ‘views/chart/chart.html’, controller: ‘ChartController’ } } […]

Clear Device Cache after logout – Ionic 2

In my application, when I logout, I’m clearing the localStorage using localStorage.clear(); But after login, if I login with some other means, after sometimes my previous ID details only visible. But after logout, when I clean device RAM and open the app means it shows correct data. I’m assuming that it is due to cache. How to clear the view cache on logout or on leaving a screen? Source: AngularJS

Next Page »