Adding ionic pages to already created Angular app [ionic] - ionic-framework

I've successfully converted the angular app into an ionic app which can run on iOS and Android. Now I am trying to grab the lifecycle methods (ionViewDidLoad, ionviewdidleave, etc) when the components appear/disappear. The app currently does not have any ionic pages, do I need to add a page(s) to get these lifecycle methods? I've been doing ionic for a week or so, so please keep the flame on low.
Thanks

Ionic 4 has deprecated the previous IonicPage and its navigation. It now uses the default navigation of the template you are using. In case of angular its angular router
Previous versions of Ionic shipped with our own custom router, but in order to provide the best tooling and developer experience we have since moved to using the framework's recommended router.
Ionic 4 provides the hooks:
ionViewWillEnter, ionViewDidEnter, ionViewWillLeave, and ionViewDidLeave
Also check migration guide here.
You can use the angular lifecycle hooks in place of the older ionic lifecycle hooks like ngOnInit in place of ionViewDidLoad. Use angular's router guard instead of ionic's navguard.

Related

Using ionic to make an app for Androids and iPhones

I've just finished building my website and will deploy it shortly, however I want to make an app and I was hoping to find a way of taking my existing front end code and dump it into ionic and get a nice app out of it.
Is it going to be that simple to make an app using ionic or will I have to rebuild the front end all over again if I'm going to use ionic?
It depends on what you made your site with. If you used a framework compatible with ionic like angular it is fine (see this article: https://levelup.gitconnected.com/converting-angular-web-application-into-ionic-app-5af678325626)
If you have developed in pure Html / css / js you can always reuse part of your code but you will need to import it in a framework (React, Vue or Angular)

How can i design this page in ionic 4

how can I design that page in ionic 4? I'm still new to ionic. its a bank app I am building with ionic 4, below is the image of the page.
You should start here, https://ionicframework.com/ read through documentation.
Your app looks like a tabs based app so it would be easiest to start with a tabs ionic project.
Therefore, run ionic start myBankAppName tabs --cordova to use cordova as your native cross-platform engine or ionic start myBankAppName tabs --capacitor to use capacitor for the same purpose.
After that consult the relevant components that you need at https://ionicframework.com/docs/components.
Have fun! ;)

Interface for Ionic angular 2

Is it recommended to use interface in ionic 2?
Which means is it fine to use interface in ionic 2 or strictly we should not use it. My purpose of using interface in ionic2 is want to create a custom modal in my ionic application.
thanks
AK
I see no reason to not use TypeScript interface in your Ionic project.
It's a standard principle in TypeScript and the whole Ionic Framework is written in TypeScript. At the end it will be compiled to JavaScript anyways.
Here are some resources
https://www.typescriptlang.org/docs/handbook/interfaces.html
https://ionicframework.com/docs/developer-resources/what-is/#typescript

Is there a way to get Ionic components without Angular?

I want to build an app with Ionic and VueJS, and I want to get Ionic components working in Vanilla JS, is there any library or resource to do that?
This will be possible in the near-future with Ionic 4. Their framework will soon be framework agnostic, which means it will be usable with any JS framework or even plain JS. You can read all about it on the official blog post of Ionic.
Here's an excerpt of the article:
For those that love Ionic but want to use it with Vue, or React, or Ember, or jQuery, or plain JavaScript, you’ll be able to once Ionic 4 releases.

Difference between react and ionic framework

I have read some docs and i do not really understand what are the differences between react and ionic frameworks.
Is one of them made from the other ?
I have to store local data. I suppose one of them is just web and javascript so data is only stored on server ? Or is it possible to do local storage with both of them.
Is it possible to host the app on a web server without having a "real" app ?
Thanks
Hi I think that you are a little bit confused. I hope this clarify your doubts:
Ionic framework is a set of tools for create Hybrid apps using html/css and javascript, It is build using apache cordova and Angular 1. In the other hand you have React a library for build rich UX(User experience) web apps.
Ionic is not build on react. They are different purpose tools but you can use that together (Using IONIC 2).
In both cases you can use local storage, but if you want to store data in servers you have to build your own backend to provide data to the app They are front end oriented frameworks(no server side)
You can put Ionic code on a server it is simple JavaScript and HTML but this is not the purpose of the framework and if you do it, you loose the native apis of the device. In the case of React it is just a library and you can use it in an existing project using HTML and Javascript or build your app entirely with it.
You have a long road ahead, hope this help you.
Ionic is an HTML5 mobile app development framework targeted at building hybrid mobile apps. They are essentially small websites running in a browser shell in an app that have access to the native platform layer.
React Native is the next generation of React – a JavaScript code library developed by Facebook and Instagram, which was released on Github in 2013. React Native lets you build mobile apps using only JavaScript.
They have their own way of functioning, below are few points on their differences:
Ionic is a regular web app, written using HTML, CSS, and JavaScript, but it runs in a webview embedded in a native app instead of in a stand-alone mobile browser
React Native has a completely different architecture: instead of writing your UI using web technologies, it uses the React component model to render to native views.
Ionic is a Cordova based app that wrap current web app into a mobile application. It uses the android existing web view to render the app so the file size is quite small
Meanwhile react native create bridge between JavaScript and native component.
When it comes to memory usage, Ionic framework uses more than react native apps
The Ionic app is slower at loading videos because it needs to download from other server, while in react native, it caches the tiles so it loads faster.
When it comes to integration, react native can use every client based JavaScript modules from npm (node package manager) whereas Ionic uses only the Cordova-based code.
Ionic is a framework that creates an idea of writing code only once
React native is not a write once and run anywhere framework, but is popularly touted as a “learn once, write anywhere” framework
Ionic Framework app needs to use device features and APIs through Apache Cordova plugins.
With react native you can access any device component or API
Based on the points above, you can see the difference in their functionalities, so if you want to go for something that creates performant iOS and Android apps that feel at home on their respective platforms ten you can opt for React Native.
And, if you are targeted at building hybrid mobile apps, Ionic is the best choice!