ionic2

What is the ionic2 best practice to show loading, alerts and logs?

我是研究僧i 提交于 2020-03-03 11:53:51
问题 I'm looking for ionic2 best practice to show loadings, alerts and console logs.. so instead of repeat the code below in each page so I can call it once. For example code to show loading: showLoading() { this.loading = this.loadingCtrl.create({ content: '' }); this.loading.present(); } Is it the best practice to create a provider, and show the loading from the last? or the provider doesn't support loading or something similar ? Thanks. 回答1: I usually create a lib folder (or module if you want)

Ionic2: handle a provider

|▌冷眼眸甩不掉的悲伤 提交于 2020-03-03 09:28:10
问题 While developing a ionic2 project, I created a new provider but I have some difficulties in setting variables in MyClass. import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import 'rxjs/add/operator/map'; @Injectable() export class MyClass { token_acces: any; token_room: any; constructor(private http: Http) { this.token_acces = null; this.token_room = null; } login(id,pwd){ let headers = new Headers(); headers.append('Content-Type', 'application/json');

Ionic2: handle a provider

两盒软妹~` 提交于 2020-03-03 09:28:05
问题 While developing a ionic2 project, I created a new provider but I have some difficulties in setting variables in MyClass. import { Injectable } from '@angular/core'; import { Http, Headers } from '@angular/http'; import 'rxjs/add/operator/map'; @Injectable() export class MyClass { token_acces: any; token_room: any; constructor(private http: Http) { this.token_acces = null; this.token_room = null; } login(id,pwd){ let headers = new Headers(); headers.append('Content-Type', 'application/json');

Array with custom indexes in Ionic2

僤鯓⒐⒋嵵緔 提交于 2020-03-02 09:41:25
问题 I am creating an array in a variable in Ionic2 as: allMonths = {'01':'January','02':'February','03':'March','04':'April','05':'May','06':'June','07':'July','08':'August','09':'September','10':'October','11':'November','12':'December'}; I want to get all months (with keys specified) i am displaying them in html as : <ion-item> <ion-select [(ngModel)]="allMonths"> <ion-option value="{{months.key}}" *ngFor = "let months of allMonths | keys">{{months.value}}</ion-option> </ion-select> </ion-item>

Typescript Error Cannot find name 'google' in ionic2 when using googlemaps javascript API

耗尽温柔 提交于 2020-02-23 08:59:49
问题 I am following Joshua Morony's Getting Started with Google Maps in Ionic 2 video tutorial. I want to use google maps in my application and i end up with a typescript error. this is a part of the pages/home/home.ts file initMap(){ let latLng= new google.maps.LatLng(6.929848, 79.857407); let mapOpt={ center : latLng, zoom : 15, mapTypeId :google.maps.MapTypeId.ROADMAP }; this.map= new google.maps.Map(this.mapElement.nativeElement,mapOpt);} I tried npm install --save @types/googlemaps , but it

How to restrict user to use specific domain to sign up my app using firebase [duplicate]

醉酒当歌 提交于 2020-02-23 07:11:07
问题 This question already has answers here : How to disable Signup in Firebase 3.x (4 answers) Closed 2 years ago . I'm currently developing an app for my university using Ionic 2 and Firebase. So, the problem is how to restrict user from signing up unless they're using specific domain eg.(@ukm.edu.my)? It's for my university, I don't want anyone else to use this app. So, anyone without that specific email domain can't sign up for my app. From what I've read, Firebase database rules only affect

Google Fonts in Ionic 2

余生长醉 提交于 2020-02-22 05:38:20
问题 I am trying to use Google Fonts in Ionic 2. After researching Stackoverflow & Ionic Forum, I have imported the font & included the base in the variables.scss as follows @import url('https://fonts.googleapis.com/css?family=Lato'); $font-family-base: "Lato"; $font-family-md-base: "Lato"; $font-family-ios-base: "Lato"; $font-family-wp-base: "Lato"; Obviously, this is not rendering the font. What am I doing wrong or what else needs to be done? 回答1: In case this helps anybody, I needed to get a

Google Fonts in Ionic 2

你。 提交于 2020-02-22 05:38:12
问题 I am trying to use Google Fonts in Ionic 2. After researching Stackoverflow & Ionic Forum, I have imported the font & included the base in the variables.scss as follows @import url('https://fonts.googleapis.com/css?family=Lato'); $font-family-base: "Lato"; $font-family-md-base: "Lato"; $font-family-ios-base: "Lato"; $font-family-wp-base: "Lato"; Obviously, this is not rendering the font. What am I doing wrong or what else needs to be done? 回答1: In case this helps anybody, I needed to get a

Import two exported classes with the same name

我们两清 提交于 2020-02-17 17:58:20
问题 In typescript, using Angular 2, I need to import two classes with the same name, but lying in different paths. The project is quite too big that I find it hard to change the exported class names. Is there any way to alias the imported classes, import {Class1} from '../location1/class1' import {Class1} from '../location2/class1' 回答1: You can use as like this: import {Class1} from '../location1/class1' import {Class1 as Alias} from '../location2/class1' You can find more about the ES6 import

Import two exported classes with the same name

别等时光非礼了梦想. 提交于 2020-02-17 17:56:19
问题 In typescript, using Angular 2, I need to import two classes with the same name, but lying in different paths. The project is quite too big that I find it hard to change the exported class names. Is there any way to alias the imported classes, import {Class1} from '../location1/class1' import {Class1} from '../location2/class1' 回答1: You can use as like this: import {Class1} from '../location1/class1' import {Class1 as Alias} from '../location2/class1' You can find more about the ES6 import