ionic-framework

How to restart ngOnInit to update Interpolation

落花浮王杯 提交于 2020-01-04 09:03:09
问题 Is there way to restart ngOnInit() on change variable Because I want to restart ngOnInit() on change theme variable, this is my code Settings.ts export class SettingsPage implements OnInit{ phraseColor: string; ngOnInit() { let tch : {} = {'#3f51b5': 'Blue', '#ff9800': 'Orange'} let ColorName = tch[this.settingsService.theme]; /* here my problem */ this.phraseColor = ColorName; } changeTheme(){ this.settingsService.theme = '#ff9800'; } } Settings.html <div>Theme is {{ phraseColor }}</div>

JSON.parse nested JSON string property parsing

戏子无情 提交于 2020-01-04 08:27:12
问题 I am getting the following string from an API module: {"value":"{\"Id\":\"100\",\"OrganizationName\":\"[_+-:|;'.\\\/] Arizona Grower Automation\"}"} When I use JSON.parse on the client side, I get: Uncaught SyntaxError: Unexpected token I in JSON at position 12 This works if the quotes inside are double escaped, but whats the best way to do this ? More specifically this is returned by an Ionic Capacitor plugin from the native code to JavaScript environment. 回答1: You need to escape backslash

JSON.parse nested JSON string property parsing

微笑、不失礼 提交于 2020-01-04 08:27:06
问题 I am getting the following string from an API module: {"value":"{\"Id\":\"100\",\"OrganizationName\":\"[_+-:|;'.\\\/] Arizona Grower Automation\"}"} When I use JSON.parse on the client side, I get: Uncaught SyntaxError: Unexpected token I in JSON at position 12 This works if the quotes inside are double escaped, but whats the best way to do this ? More specifically this is returned by an Ionic Capacitor plugin from the native code to JavaScript environment. 回答1: You need to escape backslash

Property 'x' is private and only accessible within class 'y'

人盡茶涼 提交于 2020-01-04 08:05:49
问题 I have this piece of code: import { Component } from '@angular/core'; import { NavController, Loading, Alert } from 'ionic-angular'; @Component({ templateUrl: 'build/pages/search/search.html', }) export class SearchPage { constructor (....) { // code here } findItems() { let loading = Loading.create({ content: "Finding items..." }); this.nav.present(loading); // other stuff here } When I run ionic serve everything shows correctly but when I click a button which calls findItems() method I get

SignatureDoesNotMatch error when uploading to s3 via a pre signed url using Ionic 2

点点圈 提交于 2020-01-04 07:47:12
问题 I am trying to upload a video to s3 and have a pre-signed PUT url. The following is the code to do so. import {Component} from '@angular/core'; import {NavController} from 'ionic-angular'; import {MediaCapture} from 'ionic-native'; import {Http} from '@angular/http'; import { Transfer } from 'ionic-native'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { public base64Image: string; constructor(private navController: NavController, public http: Http) {

PouchDB fails to sync on iOS 9 - iPhone 5S

ε祈祈猫儿з 提交于 2020-01-04 07:11:33
问题 I am developing an app with IONIC and PouchDB. The app perfectly synchronizes with remote CouchDB and works perfectly well on Android. But the PouchDB fails to sync on iOS. I am testing on iOS 9 and iPhone 5S. What could be going wrong with the code in iOS ?? 回答1: Are you using WKWebView? PouchDB does not support WKWebView, unless you use the FruitDOWN adapter: http://pouchdb.com/adapters.html#pouchdb_in_the_browser 来源: https://stackoverflow.com/questions/35293323/pouchdb-fails-to-sync-on-ios

PouchDB fails to sync on iOS 9 - iPhone 5S

坚强是说给别人听的谎言 提交于 2020-01-04 07:11:27
问题 I am developing an app with IONIC and PouchDB. The app perfectly synchronizes with remote CouchDB and works perfectly well on Android. But the PouchDB fails to sync on iOS. I am testing on iOS 9 and iPhone 5S. What could be going wrong with the code in iOS ?? 回答1: Are you using WKWebView? PouchDB does not support WKWebView, unless you use the FruitDOWN adapter: http://pouchdb.com/adapters.html#pouchdb_in_the_browser 来源: https://stackoverflow.com/questions/35293323/pouchdb-fails-to-sync-on-ios

Angular/Ionic 2 - what is a provider and what does `static get parameters()` do?

一世执手 提交于 2020-01-04 06:51:27
问题 I am learning Angular 2 (with Ionic 2) - there are two concepts which I cannot relate to from Angular 1. I have a class like follows: import {App, Platform} from 'ionic-angular'; import {RegisterPage} from './pages/register/register'; @App({ templateUrl: 'build/index.html', config: {} // http://ionicframework.com/docs/v2/api/config/Config/ }) export class MyApp { static get parameters() { return [[Platform]]; } constructor(platform) { this.rootPage = RegisterPage; platform.ready().then(() =>

Ionic2: Unsubscribe Event to Avoid Duplicate Entries?

限于喜欢 提交于 2020-01-04 06:06:11
问题 I've followed this tutorial which outlines adding monitoring beacons in an Ionic 2 application. I have it working great: when the view loads, it initializes and begins listening for beacons: home.ts ionViewDidLoad() { this.platform.ready().then(() => { this.beaconProvider.initialise().then((isInitialised) => { if (isInitialised) { this.listenToBeaconEvents(); } }); }); } This calls the listenToBeaconEvents function which populates a list in the view with all of the beacons: home.ts

My [(ngModel)] is not working in the custom component in Ionic 4

送分小仙女□ 提交于 2020-01-04 05:35:49
问题 I am working in my Ionic 4 project and I have created a custom component but in that custom component my [(ngModel)] is not working. This is my custom-header-component.component.html: <ion-select [(ngModel)]="languageSelected" (ionChange)='setLanguage()' ngDefaultControl> <ion-select-option value="en">English</ion-select-option> <ion-select-option value="ar">Arabic</ion-select-option> </ion-select> In this html my [(ngModel)] is not working because it is not printing any value in the console.