Which version of ionic should we use - angularjs

We currently have a web app based on AnjularJS 1.4. Now we need to develop mobile apps for our product. We think ionic to be a good framework for us since it's Angular based.
The team has no experience on ionic framework. Now the question is which version of ionic should we use? How to convert one AngularJS 1.4 we app into ionic mobile apps and maximize code reuse? Ionic 2 seems to have better performance and other benefits. Is it possible to make ionic 2 and AngularJS 1.4 coexists in the same code base and reuse current code?

There is no straight way to do it. Ionic 2 is based on Angular 2, and comes with many significant performance, usability, and feature improvements.
Ionic 1 at a very high-level is essentially just a wrapper & directive/component library for AngularJS 1.x. Ionic 2 is built to utilize all the benefits of Angular 2+.
In short, everything must be upgraded in order to get the benefits of Ionic 2. So, If everything you have is working, and performance isn't sluggish, there really is no reason to to choose Ionic 2, you can use Ionic 1.

You need to port your code to Angular 2 in order to run with Ionic 2 because Ionic 2 builds upon AngularJs 2.
It takes Angular 2 and adds additional features, like different routing, styles, etc.

Related

Upgrade AngularJS to Angular 6 in Cordova App

I have a Cordova app built using Angular 1 i.e. Angular JS. How I can upgrade the app yo latest angular version.
Will it require complete code re-write to TypeScript (TS)??
TypeScript is not a requirement for writing Angular 2+. However, Angular 2-7 does not have much in common with AngularJS as it doesn't have the same architecture or components. For example, from what i've read about it, AngularJS used a MVC model, Angular2+ does not.
So to answer your question, you will indeed need to rewrite most of your application. Going from Angular 2 to 7 is much easier as not much has changed.

Use Angular 2 pages in Angular 1

Currently we have application developed in Angular 1.X but we don't want to migrate from Angular 1.X to Angular 2, Since it is very wast application it will require more effort. We want other way around . Can we use Angular 2 features within Angular 1.X Application. In future whichever pages is created should be in Angular 2 but need to be worked side by side with Angular 1.X .. Like calling new route or new component from Angular 2 from Angular 1.X. Please let me know whether its possible or not.
Thanks
Kind of. What you are looking for is an Angular Hybrid app. Here's an article to help with what you are looking for.
Yes, it is possible.
You can use the new angular components/modules in a legacy angular application (downgrading) or you can use legacy components in the a new angular application (upgrading).
There is a section on the angular webpage describing all this. Direct link is here
https://angular.io/guide/upgrade#using-angular-components-from-angularjs-code

AngularJS app vs Ionic app: What do they have in common?

I have just started learning Angular and Ionic, and I have been asking myself, what do they have in common, so I could share my code between the two applications?
AngularJS is a framework to developing web application using Javascript and Html, Ionic is a framework for developing hybrid apps, Ionic require Angularjs to work and get all features, as documentation say:
Ionic currently requires AngularJS in order to work at its full potential. While you can still use the CSS portion of the framework, you'll miss out on powerful UI interactions, gestures, animations, and other things.
In simple words, Ionic extends Angular features and transform it in a framework for create mobile apps.
I hope this help you a bit.

Can I use Angular1 plugin in Angular2 application?

I am very new to Angular 2 and would like to know if Angular 1 plugins can be used in Angular 2. I have used ng-knob in ionic 1 app. Some suggested to use jQuery knob instead but I really want to use ng-knob as it has many more options.
Is it possible to use ng-knob in angular 2? Even if there is a harder way I would not hesitate to try it but I really wan't to use ng-knob.
Any help with sample code is greatly appreciated.
As Angular2 framework is different from Angular1 framework, I'm afraid to say that you can't use Angular1 plugin(s) for Angular2.
Angular2 is a new framework and recently became stable. So, if you are looking for Angular2 plugin(s), its very hard to find them(as of now) as community is still developing Angular2 plugin(s).
Check out the Upgrading with The Upgrade Adapter section in angular.io - point 2 and other sections till 8.
https://angular.io/docs/ts/latest/guide/upgrade.html
Use angular.umd.js file instead of angular.dev.js or angular.js for 2.x. It supports both angular1 application and angular2 application to run side by side. This way you can use 1.x plugin with angular 1.x application and still run angular 2.x application side by side. You can use Zone.js to merge two way binding between angular 1.x application and 2.x application.
But this can be complex and if you are not comfortable with advanced hacks, you should take the answer of using 1.x plugins in 2.x versions. Unless you are ready to port your 1.x plugin to 2.x plugin yourself.
Zone.js intro - https://www.youtube.com/watch?v=V9Bbp6Hh2YE Good resource from Misko.

Can We work with Ionic 2 and AngularJs 1?

I would like to develop applications using Ionic 2, but now I am working with angularJS1 with Ionic1.
I feel that AngularJs 1 is comfortable for me but not AngularJS 2, so is there any way to work with Ionic 2 and AngularJS 1?
Unfortunately, no.
Ionic 2 is based on the new 2.x (and higher) version of AngularJS, and comes with many significant performance, usability, and feature improvements.
Ionic (1) at a very high-level is essentially just a wrapper & directive/component library for AngularJS (1). In that same regard, Ionic 2 is built in the same way, utilizing all the benefits of Angular 2+.
So basically, everything must be upgraded in order to get the benefits of Ionic 2. If everything you have is working, and performance isn't sluggish, there really is no reason to upgrade it, maybe if you were starting a new project (or the current project you have is small and it would be easy)
Ionic 2 breaks away from being tied to the DOM in the browser, by using angular 2 which is the reason for the massive change between ionic 1.x and ionic 2.x. ( Angular 2.x architecture is not tied down to the DOM unlike the Angular 1.x ).
Although that means having to relearn and unlearn a lot of angular 1.x stuff, but this is a fundamental change that the ionic team has taken up in order to break away from the performance issues that has plagued ionic 1 and certainly well worth it. Now that the ionic 2 platform is stable well almost and certainly far better in performance to ionic 1, migrating is certainly a recommended option.
You can use Angular js 2 and Ionic 2 RC for your development.
https://scotch.io/tutorials/build-a-mobile-app-with-angular-2-and-ionic-2
Scotch
Build a Mobile App with Angular 2 and Ionic 2
Update (September 30, 2016): Update article to recent ionic RC.0 releaseThis article has been updated to use Ionic 2 RC.0 ReleaseThe Ionic Framework... (33KB)
Since Ionic 2 RC will be forward compatible with Ionic 2 official release
Most of the time Enterprise will wait till an official release comes out
but RnD developers use RC packages also
you dnt have to worry..

Resources