Ionic v1 or ionic v2 how can npm install be the same for both?


#1

Both V1 and V2 suggest using npm install -g ionic, both can’t be right for both version of ionic?. Say i wanted to do Udemy course which used code examples developed in ionic1 (syntax and function is different?), then npm install -g ionic is going install the latest version of ionic, where is the switch for forcing a v1 install or is v2 backward compatible?.

Is Ionic1 as a target development environment even worth learning if ionic2 is radically different and if this is the case why does ionic serve (v2) run ioinic v1 code and ionic view, which then wont run native on a device (android 5.0.0 api 21).

also you state your migrating from bower to npm, but npm install ionic installs bower files and requires migration!! (even throws an error when using build)

For a newbie to your framework, its all very confusing and a bit messy, different android targets which cant be altered easily because the default api 24 is assumed, some cordova plugins which work and others wont and is only discovered on the forums outside of here.

How is someone new going to engage in this framework and start to develop if there are so many inconsistencies and therefore folks trying to get answers to solve issues not even mentioned here.

I hope this moves on from being a framework for clique and moves into being common mobile parlance for all developers regardless of level and access to those in the know!!


#2

The Ionic CLI will support development in both versions of Ionic. The install instructions are correct.

To the real question, should “I learn Ionic 1”. IMHO, no. You are correct in denoting that a lot changed between Ionic 1 and Ionic 2. I would start fresh with Ionic 2 and look for tutorials that are RC2 or later. Some last minute changes in the framework will cause additional headaches.

I am afraid you have gotten yourself confused due to the mix of tutorials that exist.

As to the Cordova plugins, unfortunately each of those items is beyond the control of the framework. We have Ionic Native as an interface to use them, but each is a separate software project developed by other people. Hybrid development has a lot of moving parts that require some level of understanding to mesh together. That is the ‘cost’ of this kind of development.

My book from O’Reilly is out in Early Access form, and there are a few other books available or coming soon that are focused solely on Ionic 2.

The community is a good one, so as you learn, ask clear and polite questions and we should be able to guide you along.

Chris


#3

Chris

Your reply was informative, my continued confusion is why code examples run fine in ionic serve or ionic view and compile using build no errors but wont function properly (access wordpress api using $http.get), hence my questions about plugins.

Even with everything in constant motion like your implied, there needs to be a little consistency so new developers can stay on board. So why would code run fine in ionic serve and view, but not on a device, i thought maybe api version, but again this is set by ionic some where and google search on reveals how to change it in platform/android but you want to change before that, probably at the ionic start stage.

So given i was polite, i not sure how to phrase the question as not sure what is going wrong as there is no erros but no consistency either.

regards


#4

There are a lot of moving parts, most of which the Ionic team does not control. Angular 2 had been in beta for months, and some important features, like their router, only stabilized recently. (Ionic 2 routes differently, perhaps in part because of that.) Node and npm are both on their own release schedules, and bugs there have affected Ionic installs too, though everything seems stable at the moment. I bought Josh Morony’s book on Ionic 2 and the Fullstackio Angular 2 book, and read source code of several Github “accessory programs” in order to understand a bit about how to program in Ionic 2. (The book by @ChrisGriiffith wasn’t available at the time I was learning the basics, but I’ve looked at its table of contents, and it covers material similar to Morony’s book. No idea which is better.)

This is how I see it: you invest in a somewhat steep learning curve at the beginning, in order to be able to produce hybrid apps, which will save a ton of development time later.


#5

A couple of reasons off the top of my head: CORS and AoT compilation.


#6

Sorry not sure how that helps, have you a solution you want to share with the community or is this statement just another example of those in the in the know demonstrating their knowledge.

As a new developer, do you have any helpful advice or links you used to gain the knowledge you acquired from others to be in positions to reply so succinctly.

Any help would be much appreciated by a whole lot of people .

Thanks


#7

Just FYI @eric_barns, I find the approach of @rapropos to be extremely interesting. His comments are worth unpacking. Also, if you don’t know what AoT compiling is, you should probably spend some time with Wikipedia, learning about the structure of modern browsers, before you dive into Ionic 2. I don’t mean that as a slam. It’s a concrete fact that there’s a lot going on here. It isn’t like learning Javascript from codeacademy.


#8

Thanks Aaron but no lengthy period of learning is going to accomplish much if the example code in the books / video wont even run on the device as it does in the sims (serve and view)

First off new developers need a stable development base to be able to get the reassurance that it’s their code that is causing the issues and not some undiscoverable issues with development environment, which requires an expert to analyse and fix. Otherwise there is no way to know, without suffering hundreds of opinion, some very short replies from those who think their smarter without supplying an explanation (you are an exception).

Its almost like everybody is expected to go through the same learning pains, before being able even to get started, even though their are experts who can provide explanations, like right of passage. Its such a waste of resources and evolution of knowledge

No one should be made to reinvent the wheel every time? but i guess that’s what this framework and its experts require its new learners to do.

So i will keep on going until a better framework and its experts becomes more reliable for new learner to start with.

Thanks


#9

AoT compiling?, never came across it before, when using php, python or javascript in other web projects cms, ecommerce over the last 18 months, just ionic so far it would seem, so maybe you’re right a deeper understanding of the problems with the mobile framework needs unpacking to further my understanding of how to get round the issues when using this framework.

I look into that and the other ‘CORS’ and all the other suggestions on google searches, until something works and then i will take time to definitely document so others can find an easier way to get a robust example (knowledge held by a few) to help them without the unnecessary requirement to tryout endless solution (already tried by the few).

i know some think learning is best done by everybody trying out the same dead ends in order to cement learning, but we moved on since those days and now we favour knowledge sharing, so others can move faster and more securely in the knowledge gained by pioneers.

But a rant on, excuse me, got another few weeks to waste before i can get started using ionic to work meaningful with data acquisitions, at least i can get the eye candy stuff to work (UI).

Once again cheers


#10

Jumping back in here. The Wordpress API issue is due to CORS/Whitelisting. This is a common issue migrating from the browser to an emulator or device. Basically, it is increased security accessing external resources. It is always a pain (even for us ‘experts’). It is also not directly an Ionic issue, but a Cordova issue.

Ionic development is really about learning 3 technologies: Ionic, Angular, and Cordova. Back in Ionic 1 days, I would often recommend the ‘In Action’ books from Manning as a starter set of resources.

Obviously, the Ionic and Angular ones are out of date, but the Cordova in Action by Ray Camden is still a solid reference.