ionic2

How can I put an Ionic 2 Modal in a separate file?

↘锁芯ラ 提交于 2020-01-17 05:35:07
问题 I'm using Ionic 2 and want to use a Modal for different pages. One use case is the creation and editing of messages: I want to display a "new message" button on the dashboard page, another "new message" button on the messages list page and a third button "edit message" on the message view page. All of those buttons should open the same MessagesEditModal. My current code looks like that: import { Component } from '@angular/core'; import { Modal, NavController, ViewController } from 'ionic

Switch icon in ionic2 after click

夙愿已清 提交于 2020-01-17 03:05:10
问题 I have list of item, each of items has button with ion-icon <ion-list> <ion-item *ngFor="let item of items"> <ion-avatar item-left> <img src="{{item.logo}}" /> </ion-avatar> <h2>{{item.name}}</h2> <button clear (click)="changeIcon(shop)" item-right> <ion-icon name="ios-heart-outline" ></ion-icon> </button> </ion-item> </ion-list> and I want to change this icon to ios-heart after click on button. 回答1: Just like you can see in Ionic2 docs you can set the icon using a variable like this: In your

Tabs Root elements not visible

早过忘川 提交于 2020-01-16 14:39:09
问题 I'm building ionic apps its has multi-account switch option. My problem is first time its Tabs root elements page visible good but when its switch to another account with specific tabs then its visible before render page. I will show my code for your better understand. app.components.ts import {Component, ViewChild} from '@angular/core'; import {Nav, Platform, PopoverController} from 'ionic-angular'; import { StatusBar } from '@ionic-native/status-bar'; import { SplashScreen } from '@ionic

How to get Google Advertisement ID in Ionic3?

≡放荡痞女 提交于 2020-01-16 05:33:25
问题 Hi we tried to get Advertisement ID using ionic3 application.We added plugin cordova plugin add cordova-plugin-idfa --save We tried like this ONE: cordova.plugins.idfa.getInfo().then(function(info) { if (!info.limitAdTracking) { console.log('OK getting ID**********'+info.idfa || info.aaid); } }); we are getting get Cannot read property 'getInfo' of undefined TWO: declare var androidIDFA; @Component({ templateUrl: 'app.html', }) export class MyApp { googleAddId:any; if (this.platform.is(

Mocking out NavParams in Ionic3 gives back Property Data is missing in type typeOf NavParams

拈花ヽ惹草 提交于 2020-01-15 11:04:34
问题 export class NavParamsMock { static returnParam = null; public get(key): any { if (NavParamsMock.returnParam) { return NavParamsMock.returnParam } return 'default'; } static setParams(value){ NavParamsMock.returnParam = value; } } It's not working. 回答1: As the error notes the data is missing from your class so it fails. If you don't care and want to avoid these kind of errors then extend your class. export class NavParamsMock extends NavParams This will fill in the missing properties. If you

Mocking out NavParams in Ionic3 gives back Property Data is missing in type typeOf NavParams

旧城冷巷雨未停 提交于 2020-01-15 11:04:17
问题 export class NavParamsMock { static returnParam = null; public get(key): any { if (NavParamsMock.returnParam) { return NavParamsMock.returnParam } return 'default'; } static setParams(value){ NavParamsMock.returnParam = value; } } It's not working. 回答1: As the error notes the data is missing from your class so it fails. If you don't care and want to avoid these kind of errors then extend your class. export class NavParamsMock extends NavParams This will fill in the missing properties. If you

Cannot “save for Enterprise Deployment”, ios ipa

狂风中的少年 提交于 2020-01-15 10:35:27
问题 I've developed a ionic 2 app which I want to be able to send through mail or host online somewhere as an iOS app for ipad - so I need to make it ipa . I've got an Apple Developer Enterprise Program account type, and XCode 8.2.1 . I've managed to archive the app with success but when I'm trying to export it I cannot use any method except "Save for Development Deployment" which indeed generates an ipa file, but when I try to install it on ipad disappear - the installation starts, works for a

How to put a checkbox input inside an alert prompt in Ionic2?

烂漫一生 提交于 2020-01-15 08:41:11
问题 Using Ionic2 and Angular2, I want to show an alert box, inside which a text along with checkbox - to ask for user if he/she agree to the statement. 回答1: //Prompt an alert, to ask user to verify there email address. let alert = Alert.create({ subTitle: 'Email not verified!', message: 'Please check your email for verification link.', inputs: [ { name: 'getLink', label: 'Get verification link again ?', type: "checkbox", value: "true", checked: false } ], buttons: [ { text: 'Ok', handler: data =>

How does the app know a component is a page

好久不见. 提交于 2020-01-14 12:03:43
问题 Now that the @Page decorator had been deprecated, how does the app differentiate between a component that should be used as part of a page and a component that represents a page you can navigate to? The only difference I see that page components have no selector property defined in the @Component decorator. 回答1: A component is considered to be a page if it's pushed to the navigation controller's stack. A selector property is optional in an Angular2 component. You only need it when you want to

How does the app know a component is a page

北城余情 提交于 2020-01-14 12:03:12
问题 Now that the @Page decorator had been deprecated, how does the app differentiate between a component that should be used as part of a page and a component that represents a page you can navigate to? The only difference I see that page components have no selector property defined in the @Component decorator. 回答1: A component is considered to be a page if it's pushed to the navigation controller's stack. A selector property is optional in an Angular2 component. You only need it when you want to