Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I like to learn Angular 2. May I know which Angular is best typescript or javascript. I know angular 1 javascript and also ionic framework 1. If i learn angular 2 in javascript whether it help for ionic 2. may i know whether ionic 2 is javascript or typescript

share|improve this question

closed as primarily opinion-based by Dave Newton, SnareChops, Günter Zöchbauer, user2314737, toskv Feb 20 at 19:38

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
angular2 is compatible with both js as well as typescript. but most of the articals and tutorials even on the official websites angular2 is with typescript. – Pardeep Jain Feb 12 at 5:41
    
Welcome to StackOverflow. While you question is valid, it is considered as off-topic for this site. Questions that are opinion based are off-topic on StackOverflow. However to answer your question, Angular2 can be used in TypeScript, Dart, or JavaScript. Ionic2 uses Angular2 so it also supports the same. The choice is yours, however the Angular2 team recommends TypeScript. The choice is yours and yours alone. – SnareChops Feb 12 at 5:41
    
thanks. i have confused. many articles are in typescript so that i asked. anyway thanks – Deepak rao Feb 12 at 5:49
2  
Where's a good place in the stackoverflow / stackexchange world to ask these kinds of questions? I have random questions about one programing language or other of this type that it would be good to find answers for. – Agent Zebra Aug 4 at 4:50
up vote 32 down vote accepted

At the end of the day, they both are transpiled into plain old JavaScript. And yes, you can use either JS or TypeScript in Ionic 2.

Pros of using TypeScript:

  • TypeScript is a superset of JavaScript. Therefore, it can mix some great future JS features along with static typing and other TS-specific constructs, and TS will transpile into the target JavaScript profile(s) you need for your audience. You focus on utilizing features that TS supports (remember, as a superset of JavaScript... whatever JS supports TS supports) and the transpiler will emit the proper working JS for you. So, this gives you some degree of future proofing to your project, which is especially critical for long term applications.
  • Since TS must be transpiled to JS to work, unfortunately some of the runtime benefits of type safety are lost. However, type safety can help you find errors early, during the authoring (using IDE tools) and compile time, and combat regression issues. Again, this is critical for maintainability, but maintainability is more compelling than debatable "future proofing" I mentioned above.
  • Support for inheritance, interfaces, etc. bring a much better OOP experience to JS, which makes for better code decoupling and reuse.
  • Syntax may be more comfortable for C# or Java developers.
  • Angular team uses it internally and recommends it, so you can benefit from their model and tools to get the best experience.

Cons of using TypeScript:

  • If you are unfamiliar with statically typed or OOP languages, you may find it a steeper learning curve.
  • The necessity of using TS definitions for non-TS libraries can be a real hassle, particularly when ambient definition files are not provided by third parties or contain errors or omissions.
  • TS requires a compile stage; you can't just directly run it.
  • Since TS is transpiled the benefits of its features are mainly compile time; it can't fix what's broke in JS, although it make look like it as you write TS.
  • Perhaps some overhead and cruft in your transpiled JS that TS creates to support features that your JS profile doesn't currently support. In most cases, this isn't a big deal, but could create minor hassles in large projects.
  • Some of the heavy lifting to get your project created, building, testing, statically analyzed, etc. can be quite complicated and confusing, especially using traditional Angular tools like Karma which aren't exactly TS ready yet (requires some fudging and wrangling). This will get better as time goes on, though.
share|improve this answer
4  
What tricks and hacks are difficult or impossible in TS?! – Rem Feb 12 at 18:43
    
While not in the original question, I would not discount the option to use other transpilers such as Babel. I remember coming across a comparison of ES6 and ES7 support for Babel and TS though unfortunately I cannot find it. My take on the article was that Babel should be used if you want to support more of the latest JavaScript functionality while TS should be used if you want to support static typing. – Phil D. Jun 2 at 2:09
1  
"elegant tricks and hacks" - oxymoron of the year! – Den Sep 6 at 15:42

It's Your decision

What I conclude after a search on internet:

Angular 2 is getting a lot of hype and attention, but the reality is that it is still in the phase of changes. It is not intended at all to be used in production yet. So, really, you can’t and shouldn’t start your company’s next big project using it.

Because it’s still under modifications, writing about its current state and complaining about things actually might change things for the better as opposed to the general useless complaining we’re used to on the internet. It is a rare opportunity to affect technology you might be using for years to come.

All this is just to say that while Angular 2 is getting a lot of hype it is not production ready. If you have the time or freedom and find it interesting, of course, you should give it a try, and even if you don’t have the time it’s probably a good idea to keep up with the news and reading material. Eventually, the migration path will start getting clearer and when it does you’ll probably want to know as early as possible what you should be changing.

How will you know when to it’s time to start seriously looking at Angular 2?

I’m assuming you read the news every once in a while. So just make sure to keep doing it. There are plenty of communities and newsletters you can trust to update you.

share|improve this answer
    
"It is not production ready" is just your opinion. It only depends on the requirements and preferences. If you prefer to be able to already use the newest technology even when there is still change over building your application upon a framework you plan to move away anyway in the not-too-far future Angular2 might be the better choice. – Günter Zöchbauer Feb 12 at 6:25
1  
Yeah that's just my opinion. What I say in last. – Hashir Hussain Feb 12 at 6:40
    
In the angular 2 beta release post: angular say they're confident angular is ready for production. src: angularjs.blogspot.fr/2015/12/angular-2-beta.html – Souhaieb Besbes Feb 12 at 10:38
    
as someone pointed out on the IRC channel, make sure the components you intent to use as ng2 ready, if not, expect a lot of work doing that yourself. – ries Sep 4 at 17:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.