ionic-framework

Is there a way to make ion-segment look the same on both iOS and Android?

不打扰是莪最后的温柔 提交于 2020-01-03 19:31:11
问题 After setting the mode of ion-segment, they still look different after rendering them in ionic lab. I have tried setting the mode of ion-segment and ion-toolbar to "md" but they still look different. https://ibb.co/HV75Ly2 Here is an image of what they look like after setting the mode. <ion-toolbar mode="md"> <ion-segment scrollable mode="md"> <ion-segment-button value="top" checked> TOP </ion-segment-button> <ion-segment-button value="nfl"> NFL </ion-segment-button> <ion-segment-button value

slideChangeStart event does not fire when I swipe

一世执手 提交于 2020-01-03 19:03:01
问题 In my Ionic 1.3.1 app I am using the ion-slides component to display sections of a questionnaire: <ion-slides options="vm.options" slider="data.slider"> <ion-slide-page ng-repeat="s in ::vm.sections"> <div class="bar bar-header bar-positive"> <button class="button button-small button-icon icon ion-chevron-left" ng-click="vm.previous()" ng-show="::$index !== 0"></button> <h1 class="title">{{::s.text}}</h1> <button class="button button-small button-icon icon ion-chevron-right" ng-click="vm.next

Changing Ionic Menu side dynamically

霸气de小男生 提交于 2020-01-03 17:34:56
问题 I'm trying to change the Ionic 3 Menu side dynamically once user changes the language. For RTL languages menu needs to be on the right, by default it's set on left. I subscribe to TranslateService from @ngx-translate/core event when the language changes app.components.ts : this.translate.onLangChange.subscribe((event: LangChangeEvent) => { console.info(`Language change to ${event.lang}`); this.isRTL = event.lang == 'ar' || event.lang == 'fa'; if (event.lang == 'ar' || event.lang == 'fa') {

Remove divider after last item while using ngFor

徘徊边缘 提交于 2020-01-03 17:31:30
问题 I'm using this code to show a number of locations: <div class="location" *ngFor="let item of location_array"> {{item}} <hr> </div> which results in all the locations, separated by an horizontal rule. How can I edit this to get the exact same result, but without the last horizontal rule? 回答1: Use last provided by the *ngFor along with *ngIf on your <hr> : <div class="location" *ngFor="let item of location_array; let lastItem = last;"> {{item}} <hr *ngIf="!lastItem"> </div> Here is a StackBlitz

How to define optional segment parameter in Ionic Page?

旧巷老猫 提交于 2020-01-03 16:50:41
问题 How it is possible to define a optional parameter in Ionic 3 PWA? My current @IonicPage decorator looks like: @IonicPage({ segment: "landing/:id" }) But the id param must be optional. If I do not pass the id , I receive this error: Uncaught (in promise): invalid views to insert How to do it? Thanks in advance! 回答1: There is no method yet.You need to send empty string when you don’t need it.That is the workaround for this now. this.navCtrl.push('landing', { 'id': '' }) 回答2: Since Ionic 4 with

How to define optional segment parameter in Ionic Page?

拥有回忆 提交于 2020-01-03 16:50:03
问题 How it is possible to define a optional parameter in Ionic 3 PWA? My current @IonicPage decorator looks like: @IonicPage({ segment: "landing/:id" }) But the id param must be optional. If I do not pass the id , I receive this error: Uncaught (in promise): invalid views to insert How to do it? Thanks in advance! 回答1: There is no method yet.You need to send empty string when you don’t need it.That is the workaround for this now. this.navCtrl.push('landing', { 'id': '' }) 回答2: Since Ionic 4 with

FileReader not firing onloadend in Ionic 2

北慕城南 提交于 2020-01-03 15:50:27
问题 I'm trying to read a local file using the cordova-file-plugin. At the moment I'm able to read the content of local directories and select a single file. But I have problems to get the content of the file. Here's my function that's called by clicking a button after selecting a file from list: import() { window.resolveLocalFileSystemURL(this.file.nativeURL, this.gotFile, this.fail); } And here're the two functions gotFile and fail : fail(e) { console.log(e); } gotFile(fileEntry) { var file =

FileReader not firing onloadend in Ionic 2

烂漫一生 提交于 2020-01-03 15:50:13
问题 I'm trying to read a local file using the cordova-file-plugin. At the moment I'm able to read the content of local directories and select a single file. But I have problems to get the content of the file. Here's my function that's called by clicking a button after selecting a file from list: import() { window.resolveLocalFileSystemURL(this.file.nativeURL, this.gotFile, this.fail); } And here're the two functions gotFile and fail : fail(e) { console.log(e); } gotFile(fileEntry) { var file =

Spinner alert Ionic

一世执手 提交于 2020-01-03 15:38:08
问题 I want show an alert with a spinner in subTitle like: I tryed, without success: this.alertCtrl.create({ title: 'Verificando', subTitle: '<ion-spinner name="dots"></ion-spinner> foo bar' }); Any ideas ? 回答1: Unfortunately AlertController from Ionic 2 doesn't offer a way by default to embed HTML code inside the title/subtitle attribute. Will this alert be used only when you are loading something? On that case I suggest that you use the LoadingController component, with LoadingController it's

Ionic 3 enable swipe back for a single page

雨燕双飞 提交于 2020-01-03 08:53:15
问题 I've disabled 'swipe back' globally, both in root component and module config <ion-nav #appNav [root]="rootPage" swipeBackEnabled="false"></ion-nav> ... IonicModule.forRoot(MobileApplication, {swipeBackEnabled: false}), ... I need though to enable it for one page only. So'm trying to set it by passing a nav instance to constructor and then setting swipeBackEnabled to true. ionViewWillEnter() { this.nav.swipeBackEnabled = true; console.log('swipeBackEnabled ' + this.nav.swipeBackEnabled);