ionic 2 navControl push issue - ionic-framework

i am using ionic 2 for my android application. For page routing i am using
this.nav.push(LoginPage);
When i push from one page to another it's showing previous page some sections in current page. Because of this my pages are not showing as expected.
Cordova CLI: 6.5.0
Ionic Framework Version: 3.6.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 2.0.2
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.0
Xcode version: Not installed
Please help. I cant find any errors in my console. I don't know why its happening. Please suggest need to follow any particular standard for routing.
Thanks

Add loginPage import to app.module.ts file.
import { NavController} from 'ionic-angular';
Add in constructor like constructor(private navCtrl: NavController)
And push the page on stack
this.navCtrl.push(LoginPage);

Related

Ionic Live Reload not working

Live Reload has stopped working.
When I save code changes, the browser automatically refreshes, but code changes are not reflected. I need to stop my CLI and run ionic serve again in order to have any code changes reflected in the browser.
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002
I think your problem is with your current project.So please create a new project like below.
ionic start myfirstapp blank --v2
After that see whether live reload is working or not.It should work now.
ionic serve
Note: If above one is working then you can copy/ paste your previous project's custom items where you have created to this project.Hope that solution will be much quicker than try to find a solution with the old project.That is my idea.
I did these to resolve this error on my ubuntu
Remove the npm_folder and package-lock.json files
Run npm install --save-dev
Restart your system

Ionic 2 - Progressive Web App Only - How-to?

Since I only need a Progressive Web App; I was wondering if it's possible to not install Cordova as well as everything that is related to native apps when installating/setting up Ionic?
Do you think we could get rid of what is in bold? (see below after
doing an ionic info command)
Do you have any thoughts / best
practices to share?
The following components are part of Ionic or are needed
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: OS X El Capitan Node Version: v7.0.0
Xcode version: Xcode
8.2.1 Build version 8C1002
npm run ionic:build --prod
Just follow the instructions
https://www.gitbook.com/book/jgw96/ionic-pwa/details

can't build with Ionic2

I'm developing an Ionic2 application and now I want to make a build but I get an error.
ionic info returns this:
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
Ionic App Scripts Version: 0.0.36
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v4.2.6
my main.prod.ts looks like this:
import { platformBrowser } from '#angular/platform-browser';
import { enableProdMode } from '#angular/core';
import { AppModuleNgFactory } from './app.module.ngfactory';
enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
Everytime I try to do ionic build android I get this:
bundle failed: Could not resolve './app.module.ngfactory' from /home/xxx/Desktop/myApp/.tmp/app/main.prod.ts
ionic-app-script task: "build"
Ionic2 uses the Ahead-Of-Time-Compilation of Angular2 (by using ngc). What ngc does, is creating a factory out of your normal app-module and renames this module by adding NgFactory to the modules' Name.
So for example if you have an app-module called MySuperAwesomeApp, ngc creates a file which exports a factory called MySuperAwesomeAppNgFactory. And when building your Android app, ionic will search for MySuperAwesomeAppNgFactory instead of MySuperAwesomeApp, thus throwing an error, when not finding it.
In your case I suppose that you renamed your app-module (located in ./app.module.ts) but didn't change the factory name in the main.prod.ts.
For further reading on AOT, please refer to the Angular2 AOT Doc.

ionic2: has no exported member 'ionicBootstrap'

I keep finding with issue when trying to use the ionicBootstrap. I'm pretty sure everything is quite updated, and I also tried starting a blank project, and just doing:
import { Platform, ionicBootstrap } from 'ionic-angular';
Gives me this error already :(
Any ideas? :/
ionic info:
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.4
Ionic App Lib Version: 2.1.2
Ionic App Scripts Version: 0.0.38
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X Sierra
Node Version: v7.0.0
Thank you!

ionic2 - Cannot resolve all parameters error

I'm having the following ts code.
#home.ts
import {Page, NavController} from 'ionic-framework/ionic';
#Page({
templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
constructor(nav: NavController){
}
}
and I'm getting the following error.
Error: Cannot resolve all parameters for 'HomePage'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'HomePage' is decorated with Injectable.
at NoAnnotationError.BaseException [as constructor]
I've had a look on the FAQ, ionic NavController example and the documentation. But I cannot spot an error on why its complaining. For me it seems like Im importing everything correctly.
What I could be doing wrong?
Below are my system info
Your system information:
Cordova CLI: 5.4.1
Gulp version: CLI version 3.9.0
Gulp local:
Ionic Version: 2.0.0-beta.1
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: Not installed
ios-sim version: 5.0.2
OS: Mac OS X El Capitan
Node Version: v4.1.1
Xcode version: Xcode 7.0.1 Build version 7A1001
Try with:
constructor(#Inject(NavController) nav:NavController)