ionic3

Ionic 2 prevent hardware back button default

佐手、 提交于 2019-11-27 07:21:58
问题 How can I prevent default navigation when pressing hardware back button? I've tried registerBackButtonAction , but then it overwrites behavior of back button in every page which I don't want. This didn't help either. document.addEventListener("backbutton", (event) => { event.preventDefault(); }, false); 回答1: As you can see in Ionic docs registerBackButtonAction returns a function: A function that, when called, will unregister its back button action. So you can use that function to restore the

Add scss file to the Stackblitz

倖福魔咒の 提交于 2019-11-27 06:49:04
问题 Can you tell me how to add scss file to the stackblitz . I tried that.But it is not working. Please see that and let me know. I have tried to add home.html This is the project: stackblitz 回答1: Scss should work in stackblitz : @Component({ selector: 'page-home', templateUrl: 'home.html', styleUrls: [ './home.scss' ] <== add this }) export class HomePage { Styles like page-home { .buttoncls { won't work for you with default encapsulation( ViewEncapsulation.Emulated ) because page-home is not

How to go directly to a Tab

主宰稳场 提交于 2019-11-27 06:26:18
问题 I'm trying to make a homescreen page, where you don't have the tabsmenu and where I want to have some buttons to go straight to some Tab. I'm using the function this.navCtrl.push(TabsPage) ; But this function just go to the the first tab, always, to I have some extra param to go straight to some of my tabs? 回答1: I'm afraid it's not included in Ionic by default, but you can add it to your app very easily. Please take a look at this working plunker Like you can see there, we just push the page

Ionic 3 refresh side menu after login

China☆狼群 提交于 2019-11-27 05:45:35
问题 I need to display side menu items according to the role of the user. so I check in app.html if the page (role) is equal to logged in role. But it does not display items inside menu just after login but after refreshing the app using browser refresh button it displays correct items as it should. I guess the problem is ionic is caching the menu view if it is so how can I refresh the app for new menu items to display. Every time I login with another user/role, it displays menu according to the

Component is part of the declaration of 2 modules

一个人想着一个人 提交于 2019-11-27 05:03:22
问题 I try to build an ionic 2 app. When I try the app in the browser with ionic serve or launch it on an emulator everything works fine. But when I try to build it every time the error ionic-app-script tast: "build" Error Type AddEvent in "PATH"/add.event.ts is part of the declarations of 2 modules: AppModule in "PATH"/app.modules.ts and AddEvent in "PATH"/add-event.module.ts. Please consider moving AddEvent in "PATH"/add-event.ts to a higher module that imports AppModule in "PATH"/app.module.ts

IONIC 3 CORS ISSUE

 ̄綄美尐妖づ 提交于 2019-11-27 03:19:20
问题 I am having a CORS issue with Ionic 3 when attempting to make GET calls to an API. I am using Ionic local server, running ionic serve in the command line for live server. Error No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. I tried updating ionic.config.json with proxy setting but that does not seem to be working.. { "name": "projectLeagueApp", "app_id": "47182aef", "type": "ionic-angular",

ionic2 tap vs click

試著忘記壹切 提交于 2019-11-27 02:36:17
问题 I am starting with angular2 and ionic2; In ionic2, I have a button that will call a method of my component. Like this: <button secondary clear large> </button> Should I use (click) - angular2 OR (tap) - ionic2? Like this: (click) <button secondary clear large (click)="pause()"> </button> (tap) <button secondary clear large (tap)="pause()"> </button> There are some difference? You can see about (tap) in http://ionicframework.com/docs/v2/components/#gestures Thx. 回答1: If making mobile apps,

Use nav.push with side menu in ionic 2

橙三吉。 提交于 2019-11-27 02:16:16
I try to make a little app in ionic2 to learn about it but I have a problem with navigation. In fact I have well understand the difference between a rootpage (change whit nav.setRoot ) and a "normal" page (add with nav.push ). The thing is for my app I'll need to be able to open a side menu (this is ok if I'm on a rootpage but not it's not ok with the second type of page) and to be able to go back (this is ok with a push page but not with a rootpage). So for me this type of page should be push and not a root page but how repear side menu on this type of page? Thank you. EDIT: What about using

Cannot read property of 'xxx' of undefined

自古美人都是妖i 提交于 2019-11-27 02:10:37
I'm using Ionic 2, in which a component has two components and the data were shared using emitters. But when I execute the program, it comes to this error. Runtime Error Uncaught (in promise): TypeError: Cannot read property 'BillNo' of undefined TypeError: Cannot read property 'BillNo' of undefined at Object.eval [as updateDirectives] Here's my code: bill-settlement.html ... <page-bill-list (BillSelected)="onBillSelected($event)"></page-bill-list> ... <page-bill-details [billItem]="billItem"></page-bill-details> ... bill-settlement.ts @Component({ selector: 'page-bill-settlement', templateUrl

Error: more than one library with package name com.google.android.gms.license

陌路散爱 提交于 2019-11-27 02:05:08
问题 When I try to run the command ionic cordova build android out error as title above. Then I try to remove one of the gms , when I build again the deleted it appears again. how to solve this?. Here is my dependencies of my build.gradle : dependencies { compile fileTree(dir: 'libs', include: '*.jar') // SUB-PROJECT DEPENDENCIES START debugCompile(project(path: "CordovaLib", configuration: "debug")) releaseCompile(project(path: "CordovaLib", configuration: "release")) compile "com.google.android