ionic3

NullInjectorError: No provider for NavController

孤者浪人 提交于 2019-12-14 02:47:25
问题 I want to navigate on each side menu items in a click event. app.html <ion-menu [content]="content"> <ion-header> <ion-toolbar> <ion-title>Pages</ion-title> </ion-toolbar> </ion-header> <ion-content> <ion-list> <button menuClose ion-item *ngFor="let p of pages" (click)="openPage(p)"> {{p.title}} </button> </ion-list> </ion-content> </ion-menu> <ion-nav #content [root]="rootPage"></ion-nav> app.component.ts rootPage = FirstRunPage; @ViewChild('content') nav: NavController controller() { }

Ionic2 button click text box toggle

旧巷老猫 提交于 2019-12-13 21:50:25
问题 I am beginner in ionic. I wants to toggle textbox(ion-input) on button click. I am sending the following code it is not working. Please suggest some suggestion to solve it.The openTheTextBox function change the hide boolean variable into its opposite. But every time the ion-input are invisible state. HTML file <ion-header> <ion-navbar> <button ion-button menuToggle> <ion-icon name="menu"></ion-icon> </button> <ion-title>Home</ion-title> </ion-navbar> </ion-header> <ion-content padding> <h3

On iOS, When is Platform.Ready fired vs. Resume?

允我心安 提交于 2019-12-13 20:47:45
问题 I know that platform.ready will fire when an app is loaded, and platform.resume will fire when the app is opened after being paused. But, is there a certain amount of time of the app not being in use where the app will load instead of resume? If so, what is that amount of time for iOS and Android? Can't seem to find any information on this and would love to understand this, thanks! 回答1: TLDR: Typically we will receive a resume event, if an app comes from the background. If the OS is running

Ionic3 - How to update value of dynamic ngModel?

你离开我真会死。 提交于 2019-12-13 20:16:52
问题 I am using ionic 3 framework. How to change value of ngModel? I want to toggle all ion-toggle programmatically. component : allRecs:any; constructor(){ this.allRecs = [ { label: "label 1", model : "model1" }, { label: "label 2", model : "model2" }, { label: "label 3", model : "model3" } ] } public toggle(flag:boolean){ console.log(flag); } html : <ion-item *ngFor="let x of allRecs"> <ion-label> {{x.label}} </ion-label> <ion-toggle [(ngModel)]="x.model" (ionChange)="toggle(x.model)" item-end>

Show hide in ionic framework

断了今生、忘了曾经 提交于 2019-12-13 20:11:06
问题 I want a show hide function for my ionic app: Below is what I have done so far, in xyz.html file: <ion-item> <p class="font_c_2 gra_reg" (click)="onPtagClick(part.reg_id)" *ngIf="!PtagClicked"> {{part.fsp_partner_location}} </p> <p class="font_c_2 gra_reg" *ngIf="PtagClicked" (click)="onPtagClick1(part.reg_id)" style="white-space:normal;"> {{part.fsp_partner_location}} </p> </ion-item> my xyz.ts file export class xyzpage{ public PtagClicked: boolean = false; public onPtagClick(id) { { this

Change the color of Status bar items (symbols) to black

二次信任 提交于 2019-12-13 17:38:22
问题 Can I give black color for the status bar items? Because I need to change the background color to white as shown below.Then I can't see the status bar items hence those are also white color.Any help? Note: I'm testing this on Android device (6.0). this.statusBar.styleDefault(); this.statusBar.backgroundColorByHexString("#fff");//white Now (i.e. White items): I need like this(i.e. Black items): package.json { "name": "ionic-hello-world", "version": "0.0.0", "author": "Ionic Framework",

ionic2 apply ngx-translate for menu items

♀尐吖头ヾ 提交于 2019-12-13 17:21:34
问题 I am using ngx-translate for multi language support and it is working fine. but i want to apply for menu items also. How do i achieve this. I have 3 menu items, i want to change the language for every title. ts file appPages: PageObj[] = [ { title: 'Profile', component: ProfilePage, icon: 'person' }, { title: 'My Account', component: MyaccountPage, index: 1, icon: 'cash' }, { title: 'FAQ', component: FaqPage, index: 3, icon: 'chatbubbles' } ]; HTML <button ion-item menuClose *ngFor="let p of

Import json file in typescript Angular 5

落花浮王杯 提交于 2019-12-13 16:30:38
问题 I am trying to import json file in typescript class like that import * as nationalities from './mock/nationalities.json'; and it gives me an error Cannot find module './mock/nationalities.json'. and to solve this issue I added this declare module '*.json' { const value: any; export default value; } but it doesn't solve my issue and also gives my another error exception Invalid module name in augmentation, module '*.json' cannot be found. My Typescript version 2.9.2 回答1: Based on this post,

ionic2 - show ion-icon in alert controller title and buttons

末鹿安然 提交于 2019-12-13 16:08:29
问题 In ionic 2 application, is that possible to add ion-icon in the alert controller like shown below let showAlertCtrl = this.alertCtrl.create({ title: '<ion-icon ios="ios-add" md="md-add"></ion-icon>' +'Add your info', cssClass: 'myCustomCSS', message: msg, enableBackdropDismiss: false, buttons: [ { text: '<ion-icon ios="iOS-search" md="md-add"></ion-icon>' +' Ok', cssClass: 'customAlertBtn', handler: (data: any) => { } },] }); showAlertCtrl.present(); Need to display ion-icon image on both

map.setClickable is not a function in ionic

扶醉桌前 提交于 2019-12-13 13:46:00
问题 I want to get lat-long co-ordination when user clicks on map. However, when I tried to do so I’m getting an error like the following: _this.map.on is not a function. I have also tried this.map.one but still I’m getting the same error. Can any one help me? to set an on click event on map and get lat-long from map which is JavaScript API based (not native) used on browser . I am also getting the following error in setClickable : _this.map.setClickable is not a function. Here is my code: initMap