r/angularjs • • May 25 '16

Some complaints about angular2/angular-cli

https://gist.github.com/NullVoxPopuli/82ee489121fcc21a0e80aaf88559dada
9 Upvotes

29 comments sorted by

View all comments

18

u/brokentyro May 25 '16

Typescript

You don't have to use Typescript.

no recommended project structure

https://angular.io/styleguide

no default templating language

How about HTML? I would be extremely unhappy if the forced something like Jade on me by default.

6

u/gonzofish May 25 '16

Also, why does everyone think they have to inline their templates? You can do templateUrl...

3

u/eguanlao May 25 '16

TemplateUrls make another call to the server, right?

1

u/gonzofish May 26 '16

The way I use it the templates are part of my js file.

1

u/[deleted] May 27 '16

What url do you provide to templateUrl if the template is in the same file?

1

u/gonzofish May 27 '16

What I mean is that when I package my app the template gets inlined.

1

u/[deleted] May 27 '16

So you don't use templateUrl after all?

1

u/gonzofish May 27 '16

No but I'm using webpack to keep my templates external.

2

u/DerNalia May 25 '16

yeah, it really bothers me how most tutorials inline their templates. It's just a bad practice.

Reminds me of some old web java code I've seen recently where all the html is just strings in the .java files...

1

u/DecentOpinions May 25 '16

yeah, it really bothers me how most tutorials inline their templates. It's just a bad practice.

Not saying it's right, but isn't that kind of how React does it in its components? Haven't used it myself but I kind of like the look of it because since it keeps everything together.

1

u/gonzofish May 25 '16

If editors had better support for inline templates I think it'd be less of an issue for me. I'm just pointing out that using it as a gripe against angular doesn't hold water because there's an alternative.

1

u/Mael5trom May 26 '16

A number of editors already have good support for it (maybe via a plugin, some natively already).

1

u/ctanga May 26 '16

Yeah, Jetbrains IDEs have decent native support

https://gfycat.com/ImpureComfortableAmazonparrot

1

u/[deleted] May 31 '16 edited May 31 '16

Yeah and its probably why many are now doing it with Angular too. Seems "hot" right now.

Still, like many, i like to separate my templates and styling from my code. It makes your code way longer and unreadable, plus you tend to make lots of unneeded mistakes. And debugging is very hard.

Like the example that he mentions (sure its a bit weird but i doubt it will be the minority): <li *ng-for="#el of list; #idx = index" [style.font-weight]="el.generation == generation && generation > 0 ? 'bold' : 'normal'">

Thats just plain bonkers

2

u/geekygirlhere May 25 '16 edited May 25 '16

I see this so often. It drives me nuts. So much harder to manage especially when the project grows.

9

u/bemlikanz May 25 '16

Totally agreed. Mostly developers spent 5 hours with angular 2 with no ES6 knowledge and mostly of their complaints are about new ES6 changes that they are not used to and thinks Angular2 is bad.

People need to learn ES6.

Plus, even if you have to use typescript, (almost) every valid JS is a valid TS. TS impacts so little...

1

u/[deleted] May 31 '16

For me its not the syntax itself, its more that setting it up properly is still bad. The performance with Gulp or NPM on compiling it is bad (milliseconds with normal JS, to almost seconds with TS. Add concat, uglify to the mix and it just takes too long). Plus getting external librarys working is a hassle. Still haven't found how i can use an external vanilla plugin into my code that isn't written in ES6 (import/export). Not to mention the type files are annoying most of the time.

And if its primary reason to exist is to prevent mixing types, its just stupid to use. Most of the JS linters are able to tell you not to mix your types and lots of progress can be made there and with editors themselves (like many now still need to get their ES6 support improved).

And you can also have some say in that some ES6 stuff just is not that great. People want you to believe that its super amazing but it does have its downsides. Plus the team have been implementing some parts of it, just for the sake of it. Not to make things better or to have some improvements, but just for the sake of using ES6. So i can understand why people are acting like they do.

And sure, there are alternatives for using template files and whatnot, but 90% of the tutorials and solutions on stackoverflow aren't using that. So you are still kinda forced to implement them or at least get to know them pretty well or you will end up losing lots of time just to get to the point where a problem is solved.

-4

u/DerNalia May 25 '16

Unfortunately, I can't not use TS, cause #enterprise.

As for templating, I'd at least prefer handlebars. Html isn't a templating language. It's just markup.

And that style guide offers very little guidance.

I've since adopted ember's module unifications RFC for my project.

2

u/yesman_85 May 25 '16

You can't use TS because of enterprise? But you can switch to Angular2? I think in an enterprise env TS is much more acceptable than plain JS.

1

u/billycodes May 25 '16

They actually said the opposite. Re-read the comment:

I can't not use TS, cause #enterprise.

0

u/yesman_85 May 25 '16

Oh that makes sense, I guess.