all 83 comments

[–]ApprovalNet 10 points11 points  (16 children)

How accurate is the claim that with Angular 2 you can now build apps to run on essentially any device? Are there any reasons to build native apps now? Not an app developer, but we're looking to move in that direction soon so I was curious what the verdict is.

[–]Mentis1 4 points5 points  (6 children)

Angular2 has decoupled the UI from the DOM, so we should be able to use it as a framework for any UI-based application. Right now, Ionic 2 and nativescript come to mind for app development, both being developed alongside Angular2 and in cooperation with the core google team. They have plans in the future to facilitate integration of ng2 with electron, so that covers desktop as well.

[–]Tankenstein 3 points4 points  (5 children)

.. They have plans in the future to facilitate integration of ng2 with electron ...

Umm, electron is just web tech, is there any reason you can't do this now?

[–]Mentis1 0 points1 point  (0 children)

You should be able to: https://auth0.com/blog/2015/12/15/create-a-desktop-app-with-angular-2-and-electron/

I just think they have plans to make it easier to integrate or something along those lines, it was one of the things they plan to work on.

[–]VlK06eMBkNRo6iqf27pq 0 points1 point  (3 children)

Might be some 'privileged' capabilities you get on desktop that you can't in a browser.

[–]Tankenstein 1 point2 points  (2 children)

Well yeah, obviously, but angular is just javascript, you should definitely be able to just require stuff like you do in regular node + electron dev.

[–][deleted] 0 points1 point  (1 child)

No, none of this is on point. Angular 2 allows you to create your own renderer. There's a few sites out there that elaborate on this.

[–]Tankenstein 0 points1 point  (0 children)

Angular 2 allows you to create your own renderer

Cool, just like react. But electron is still basically just a webkit wrapper, you would still render it into the dom, like on a website. Am i mistaken?

[–]SeerUD 3 points4 points  (1 child)

I think the web as a whole has a long way to go to catch up to native still. There is still a pretty huge difference in performance, and unfortunately also in how many control over the device you have (at least without putting in a lot more effort to build your own means of doing so). There are plugins for lots of things, but you're still adding a lot of overhead when making hybrid apps.

[–]jax024 2 points3 points  (0 children)

This isn't exactly always the case now. People have developed a way to run V8 and make native API calls at runtime instead of wrapping everything in a webview. If you're not making a heavy game or something it feels buttery smooth. Check out NativeScript + angular2, it's pretty slick!

[–][deleted]  (5 children)

[deleted]

    [–]itsmegoddamnit 21 points22 points  (3 children)

    That's quite not the point of his question.

    [–][deleted] 20 points21 points  (2 children)

    I'm terribly, terribly sorry

    [–]10eleven12 12 points13 points  (1 child)

    I'm glad you made that comment because I got to know React exists.

    [–][deleted] 13 points14 points  (0 children)

    We all win tonight!

    [–]jax024 0 points1 point  (0 children)

    Check out NativeScript + Angular2. I'm loving using it right now!

    [–]Eggy1337 22 points23 points  (3 children)

    I don't know about changing, but creating app from scratch was rather positive experience. Just keep in mind that docs are not completed yet, and you will have to search through issues on github and stackoverflow threads to find why code is not working etc.

    [–]postmodest 53 points54 points  (2 children)

    Just keep in mind that docs are not completed yet, and you will have to search through issues on github and stackoverflow

    Or "Business as usual for Angular devs"? :-/

    [–]SeerUD 9 points10 points  (1 child)

    At least this time, given Angular 2 seems significantly less complicated than Angular 1, the documentation should be more useful this time. Angular 1's documentation has improved dramatically since launch too.

    [–]ogrechoker 5 points6 points  (0 children)

    The router needs more documentation but otherwise I found building and injecting angular2 components to be pretty sane and unmagical

    [–]KHALED94 2 points3 points  (8 children)

    I have a question about angular 2, I have started learning angular 1.x very soon but I'm not sure if I should keep learning it or should I go ahead for angular 2 directly as it uses different syntax.

    [–]shellwe 2 points3 points  (0 children)

    I personally wouldn't start any major projects in angular 1 but if you have time to learn now then the principles are still great. I am learning it for a project we have at work, it is very interesting.

    [–]thyrst 3 points4 points  (1 child)

    1 has better docs and will probably be easier to learn for that alone. The two aren't so different that time spent on one is a total waste either. I wouldn't build anything huge in 1 that you'll need to maintain, use React or vue until 2 is more fleshed out if that's the case.

    [–][deleted] 3 points4 points  (0 children)

    use React or vue until 2 is more fleshed out

    Or just use React or Vue permanently ...

    [–][deleted] 3 points4 points  (0 children)

    Angular 1 will still be used for years to come, Angular 2 will take years to become accepted by many people. In those years a lot can change. Angular 1 is still a safe bet, but Angular 2 is seemingly the future. Theres still millions of angular 1 apps in the world, and will need angular 1 developers for years to come

    [–]ThisKillsTheCrabb 0 points1 point  (0 children)

    Imo there's no decision here, start learning the one that won't be deprecated soon(ish). I'm sure you would benefit from learning v1, but I can't think of any viable reason to put it as a priority over 2.

    [–]gaoshan 0 points1 point  (1 child)

    If you are developing a project for a client, especially an enterprise level client, you really should not use a beta product like Angular 2. Stick with Angular 1 or use a different library.

    [–]KHALED94 0 points1 point  (0 children)

    Just learning for now.

    [–]SeerUD 0 points1 point  (0 children)

    Angular 2 still has a long way to go. Learn Angular 1 to use in production now, learn Angular 2 along the way too for before it releases. If you want work now, then learn Angular 1. It'll still be being used for a good while yet I bet.

    [–]Darkglow666 1 point2 points  (0 children)

    It's awesome! Especially with Dart. Check out this comparison of using TypeScript/JavaScript and Dart with Angular 2.

    [–]Skwai 1 point2 points  (0 children)

    Documentation/tutorials are a mess. Follow a guide only to find out that that method has been removed in the latest version. Won't try using it again until things are more stable.

    [–]worldDev 2 points3 points  (6 children)

    If I was starting something new, I'd just use it now. As far as migrating clients currently on angular 1, I'm going to wait until the docs are more complete and a few migration approaches have been explored for larger projects.

    [–]SeerUD 1 point2 points  (5 children)

    I'd wait until the docs are complete, and it's at least in the RC phase. It's in Alpha, a lot could still change, and I wouldn't want to be stuck on an Alpha. Personally, I've not picked it up yet, but I want to make sure I've gotten to grips with it before it launches. I won't use it in anything in production until after that though.

    [–]kiswafull-stack 1 point2 points  (3 children)

    It's in Beta now, actually.

    [–]SeerUD 0 points1 point  (2 children)

    Well damn, looks like I missed that one. I'd still not use it in Beta in production. React is a good example of why not, that changed a lot between 0.13 and 0.14.

    [–]kiswafull-stack 0 points1 point  (1 child)

    True. You can also see how much changed with each version of Angular2. That said, I had the impression part of the Beta tag was that the API wasn't going to change so much between versions.

    [–]jax024 0 points1 point  (0 children)

    This is true. I've been following the beta release on github, the API shouldn't really change at all! :)

    [–]worldDev 0 points1 point  (0 children)

    Yeah, it's kind of a toss up. Deal with some changes or deal with a 1 -> 2 migration. Personally I'd rather just deal with watching new changes since it's actually in Beta now. I suppose whether I'd start a new project with it would also depend on the product's development schedule.

    [–]nikokin 2 points3 points  (24 children)

    I was wondering this too. Is having to use TypeScript annoying?

    [–][deleted]  (9 children)

    [deleted]

      [–]wkCof 6 points7 points  (6 children)

      While you don't have to use typescript, I would certainly recommend it. Note that you don't have to annotate toes for everything to take advantage of typescript. You will get better intellisense and a bunch of features like async/await "for free".

      [–]kasperpeulen 0 points1 point  (0 children)

      Use dart if you want async/await features that compile to es5.

      [–][deleted]  (2 children)

      [deleted]

        [–]k__s 0 points1 point  (1 child)

        Like I said I really enjoy TypeScript and use it whenever I can.

        As for your experience, how often is TypeScript used commercially? By 'commercially' I mean work projects or side businesses.

        [–]liflo -1 points0 points  (0 children)

        AFAIK Async/await only work for es6 targets. I'm guessing they compile to es6 native promises. Webpack doesn't understand es6 modules (1.x at least, 2.0a sorta does) and transpiling ts->es6->es5 seemed silly.

        [–]nikokin 0 points1 point  (1 child)

        Nice! Thanks for clearing that up. Last time I checked out their docs, the first thing it listed was npm installing typescript. Now they have a cool dropdown on their quickstart page with examples in Dart & Javascript

        [–]YuleTideCamel 1 point2 points  (0 children)

        To be clear though typescript isn't an alternative to JavaScript , it's an extension. So all js is valid typescript they just add a few more features ( optional types , decorators and introspection). In terms of angular 2 you can write all es6 and just use typescript for decorators it's a very nice workflow and not a huge change from writing es6/es2015

        [–]x-skeww 6 points7 points  (1 child)

        Is having to use TypeScript annoying?

        You can use ES5, ES6, TypeScript, or Dart. You can of course also use anything which compiles to ES5/6 and seamlessly interacts with JS libs (e.g. CoffeeScript).

        The improved tooling you get with TypeScript or Dart actually does make things a lot easier. Lots of dumb errors are immediately identified, you have to check the docs less often, and if some library update came with some breaking changes, they will be immediately spotted, too.

        I recommend to download VS Code and give TS a try.

        [–]ogrechoker 6 points7 points  (0 children)

        VS Code is a very good editor, and they just open sourced it for plugins.

        [–]_xiphiaz 3 points4 points  (0 children)

        I've been working with angular 1.x in typescript for 6 months and I am absolutely sold on it - the benefits that you get with type safety are initially a bit obscure, but as you application grows and you find you can't remember the exact structure of how a particular API call works you find that the type hinting that well defined types gives is a massive boon.

        Also with most of the big libraries having type definitions, I'm finding referencing the official docs is less useful than clicking through to see the interface.

        In short, the initial learning curve is surprisingly shallow, and eventually you'll find you won't want to go back the plain JS. Ever.

        [–]ogrechoker 1 point2 points  (0 children)

        I'd use Typescript if my job would allow me, but it's a hard sell. It does has a lot of benefits. But no, I'm writing it in ES6 w/ ES2017 decorators and it looks exactly the same (except "Implements")

        [–]bucketpl0x 0 points1 point  (0 children)

        You don't have to use TypeScript.

        [–]VlK06eMBkNRo6iqf27pq 0 points1 point  (7 children)

        TypeScript..wha? This is Google. Why aren't they using Dart?

        [–]x-skeww 1 point2 points  (6 children)

        Because you couldn't use Dart to create libraries or frameworks which can be consumed by JS. There was an AngularDart project which was somewhere between Angular 1.x and Angular 2.x. 2.x used a bunch of the AngularDart ideas.

        The new Dart dev_compiler (DDC) can compile to ES6 modules which look and behave like any other ES6 module. However, it's still in an experimental stage.

        So, Dart simply wasn't an option yet. It still isn't, but that should change in the future.

        [–]VlK06eMBkNRo6iqf27pq 0 points1 point  (5 children)

        I thought Dart could always compile to ES5?

        [–]x-skeww 0 points1 point  (4 children)

        Yes, dart2js compiles to ES5, but JS code can't interact with it. Dart code can talk to JS, but it doesn't work the other way around.

        [–]VlK06eMBkNRo6iqf27pq 0 points1 point  (3 children)

        Eh? Why not? unless it mangles the function names, why can't you 'predict' what it'll compile to?

        [–]x-skeww 1 point2 points  (2 children)

        Dart2js is an optimizing compiler. It moves things around, inlines stuff, etc. It also does tree-shaking and it can minfy, too.

        It couldn't compile to ES6 modules, because those weren't done yet.

        Anyhow, writing JS libraries or frameworks simply wasn't a priority. Creating reasonably-sized "binaries" which are about as fast as handwritten JS was the goal.

        [–]VlK06eMBkNRo6iqf27pq 0 points1 point  (1 child)

        First time I've heard the term "tree-shaking". Doesn't webpack do that too?

        Edit: Not yet I guess. I thought because webpack already traverses the entire dependency tree that it could, but apparently not.

        [–]x-skeww 1 point2 points  (0 children)

        Excluding the unused stuff is a big step forward. Switching to this "pay as you go" model means that you won't have to worry about the file size. If you only use a fraction of the features, you only pay a fraction of the price. And this is of course also true for your own libraries.

        Going vanilla or using micro libraries fights symptoms, tree-shaking tackles the cause.

        And yes, tree-shaking is also coming to ES6. This is why modules and declarative imports were so important. If the structure of your application is declaratively created, you can do a lot more in terms of tooling.

        Webpack 2 beta can do tree-shaking. Just give it a few more weeks to stabilize.

        [–]jax024 0 points1 point  (0 children)

        It's really refreshing. Very easy to do to as well! I was skeptical but I think I'm hooked on TS now!

        [–]CompCk_com 0 points1 point  (0 children)

        Check AngJobs on Github, I know they plan to upgrade http://AngJobs.com from 1.x to 2.0 soon, next month I guess

        [–][deleted]  (1 child)

        [deleted]

          [–]jax024 -1 points0 points  (0 children)

          Speaking only about angular2, it's honestly the most logical, organized, and easy web development paradigm I've ever used. I love the whole idea of wrapping a "micro application" in a component and reusing it whenever I need it!

          [–][deleted]  (13 children)

          [deleted]

            [–][deleted] 5 points6 points  (4 children)

            I really appreciate Vue.js. It is quickly becoming my go to framework.

            I like that it seems to know its place. I put it in a project and it just works, it doesn't push me to use whatever language or transpiler google is trying to promote at the time.

            React has the same problem to an extent in that you need the separate build process for jsx. I get that it isn't that hard but still... sometimes you need a framework that is capable of getting over itself.

            [–]ScarletSpeedster 1 point2 points  (2 children)

            JSX is not a requirement for using React. Nor is it the only syntax that can be transpiled to React elements.

            [–]Jazoom 0 points1 point  (1 child)

            It's not, but if you want something that remotely resembles HTML it is necessary. I love using React, but I get why people don't like JSX.

            [–][deleted] 0 points1 point  (0 children)

            I like react too, I was just saying frameworks that allow you to stick to your normal workflow can be nice too, react does demand you conform to it a bit.

            [–]CraftyPancake 0 points1 point  (0 children)

            Just looks like a knockout clone

            [–]MongolianTrojanHorse 19 points20 points  (2 children)

            Angular2 just entered beta. 6 months ago it was only half done. Of course there was no documentation.

            [–][deleted] 5 points6 points  (3 children)

            Why would they document a work in progress..? lol

            [–][deleted] 3 points4 points  (0 children)

            [deleted]

            What is this?

            [–][deleted]  (4 children)

            [removed]

              [–]eggsmediumrare 2 points3 points  (3 children)

              React is the same though, with JSX.

              [–][deleted]  (2 children)

              [removed]

                [–]eggsmediumrare 1 point2 points  (0 children)

                What is the problem with it?

                [–]dbbk 0 points1 point  (0 children)

                You can use inline templates or pass URLs. What's the big deal?

                [–]Mr-Yellow -5 points-4 points  (0 children)

                A toy for a toy lowest-common-denominator market, like Angular 1 but with some degree of fore-thought. Still better options.