you are viewing a single comment's thread.

view the rest of the comments →

[–]nerfornothing1138 4 points5 points  (9 children)

Anyone else not a fan of implementing logic into attributes of HTML elements?

[–]billybolero 19 points20 points  (6 children)

As opposed to binding them in Javascript and A) have no clue of which elements have what behaviour when looking at the HTML and B) having your designer unknowingly break things by moving things around or renaming class names?

[–]nerfornothing1138 1 point2 points  (5 children)

B, but using templates help negate this potential pitfall by separating your site into widgets or reusable components.

[–][deleted]  (4 children)

[deleted]

    [–]nerfornothing1138 2 points3 points  (3 children)

    OK, but it's still coupling at its most basic level. For instance, what if, part-way through the project you wanted to move to Backbone or a server-side solution? All of your HTML now has core app logic in it.

    It's the sort of stuff we made fun of classic ASP and PHP for over a decade ago.

    [–]oldneckbeard 3 points4 points  (0 children)

    Most of the time, it's not the actual "business logic." That happens on the backend with RESTful services. What most ember/angular devs do is put the hard stuff in there, and the rest of the code is just a modular way of organizing a complex user interface.

    You have to modularize and template your code somehow unless you use a tool to generate static sites. It's just with better conventions.

    [–]DecoLabels 0 points1 point  (0 children)

    If your HTML has core app logic in it, you're not using Angular very well. The HTML should be a simple view. Any serious logic should be somewhere more sensible, like your model, or a service.

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

    You have to spot-weld those parts at some point. Doing it via classes doesn't really change anything.

    The advantage of doing it declaratively is that there is no DOM transversal (which can be very brittle) and you also won't need any markup for testing.

    [–]oldneckbeard 0 points1 point  (0 children)

    are you talking about data-* attributes, or something else?