I agree with this post. The worst thing about Angular is how confusing it is, particularly when it does not have to be at all. There are at least 10 things I can think of off the top of my head that are so confusing about Angular that could easily be much simpler that it tells me the framework creators must not care about understandabiltiy at all. I think for a JS framework this is a death wish, but we'll see.
Just some examples:
1. When you create a directive you initialize it with one of three different kinds of scopes. A parent scope (which is the actual controller scope object), a child scope (which prototypically inherits from the controller scope), or an isolate scope (which is an isolated scope with inheritance only to rootScope). If you don't explicitly define a scope you get a parent scope. If you write `scope: true` you get a child scope. If you write `scope: {}` you get an isolate scope. This is so fucking confusing for beginners. Why not just explicitly define what kind of scope you want so it's clear?
2. Every single example of learn AngularJS online, even examples from the 'official documentation' (that's in quotes because Angular's documentation is so atrocious that referring to it as documentation would be bastardizing the English language) give you examples of defining services, controllers and directives directly on the top-level ng-app module when in reality doing this is catastrophic and will make your app IMPOSSIBLE to unit test. You need to define services in their own modules that get aggregated into the ng-app module so you can unit test them, but there are no examples of that anywhere.
3. Speaking of unit testing, because it's supposed to be so easy in Angular right? You have this thing called angular.mock.module that's the key to everything. Now 'angular.mock.module' is different from 'angular.module' but is for some reason aliased to 'module' because that's not confusing or anything. Now you would expect for angular.mock.module to be just that, a mock module. BUT it's actually a module that depends on the angular 'ng' module meaning that it's not really a mock module at all, it's a module that includes the ENTIRE working Angular library. So you can use the 'mock' module to get the REAL injector and use that to get your REAL services which you put into the mock module to use in your tests. The entire flow is so confusing and non-descriptive that it's a wonder a beginner is ever even able to write a working unit test much less a good one. The funny part is all you hear about is "unit testing is so easy in Angular omgz" when really it's confusing as fuck but the Angular crew seems completely oblivious to that fact.
--- I could honestly write a book about my Angular rants, this is just barely skimming the surface, but the point is, Angular makes things hard and confusing when they don't need to be. I like the way Angular organizes code, but I'm willing to switch at the drop of a dime if something simpler comes along.
Comments
I agree with this post. The worst thing about Angular is how confusing it is, particularly when it does not have to be at all. There are at least 10 things I can think of off the top of my head that are so confusing about Angular that could easily be much simpler that it tells me the framework creators must not care about understandabiltiy at all. I think for a JS framework this is a death wish, but we'll see.
Just some examples:
1. When you create a directive you initialize it with one of three different kinds of scopes. A parent scope (which is the actual controller scope object), a child scope (which prototypically inherits from the controller scope), or an isolate scope (which is an isolated scope with inheritance only to rootScope). If you don't explicitly define a scope you get a parent scope. If you write `scope: true` you get a child scope. If you write `scope: {}` you get an isolate scope. This is so fucking confusing for beginners. Why not just explicitly define what kind of scope you want so it's clear?
2. Every single example of learn AngularJS online, even examples from the 'official documentation' (that's in quotes because Angular's documentation is so atrocious that referring to it as documentation would be bastardizing the English language) give you examples of defining services, controllers and directives directly on the top-level ng-app module when in reality doing this is catastrophic and will make your app IMPOSSIBLE to unit test. You need to define services in their own modules that get aggregated into the ng-app module so you can unit test them, but there are no examples of that anywhere.
3. Speaking of unit testing, because it's supposed to be so easy in Angular right? You have this thing called angular.mock.module that's the key to everything. Now 'angular.mock.module' is different from 'angular.module' but is for some reason aliased to 'module' because that's not confusing or anything. Now you would expect for angular.mock.module to be just that, a mock module. BUT it's actually a module that depends on the angular 'ng' module meaning that it's not really a mock module at all, it's a module that includes the ENTIRE working Angular library. So you can use the 'mock' module to get the REAL injector and use that to get your REAL services which you put into the mock module to use in your tests. The entire flow is so confusing and non-descriptive that it's a wonder a beginner is ever even able to write a working unit test much less a good one. The funny part is all you hear about is "unit testing is so easy in Angular omgz" when really it's confusing as fuck but the Angular crew seems completely oblivious to that fact.
--- I could honestly write a book about my Angular rants, this is just barely skimming the surface, but the point is, Angular makes things hard and confusing when they don't need to be. I like the way Angular organizes code, but I'm willing to switch at the drop of a dime if something simpler comes along.