Thread with 1 post

jump to expanded post

It's incredible how people are overcomplicating Angular (and other frameworks as well). Just because there's a "smart" feature included, it doesn't mean you should use it.

One concrete example I'm currently having a problem with is implementing complex access/permissions behavior through a directive. I assume the intention was: e.g. this: <span *canAccess="null; currentUser.perms; Access.READ">Thing to access</span>. I believe it's intention is clear, the future users of this know how you can show parts of the UI only to people who are supposed to.

But that's actually false, and people do not, in fact, know how to do it. If it was a simple <span *ngIf="canRead()">, any Angular rookie knows this. By making your own custom directive, now people need to learn not just Angular, but also your DSL. It makes sense in big apps with several teams unrelated to eachother. But a lot of the time I see this kind of smart-ass code in a small team and a relatively small app. A dev learned a new trick, and used it. And now two years later, he's long gone and you have to actually go fix things, and you don't understand the intention any more.

Stick to simple, straightforward concepts in Angular, please.

#angular #software #webdevelopment

Open thread at this post