News for hackers. Stuff that matters.
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by MatthewPhillips on Thursday May 30, 2013 @12:26AM (#5790927)
Seeing the word "controller" in markup makes me want to gag myself.
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by mugenx86 on Thursday May 30, 2013 @12:56AM (#5791002)
The controller directive is necessary to determine the scope of the variables/functions embedded in the view.

But I do agree on the point that designers would certainly gag when seeing this... A developer would need to go though the deign and insert all the hooks. This step is unavoidable with any web application framework.

That being said, I think a designer would puke if they were required to write React components.

Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by metaphorm on Thursday May 30, 2013 @11:49AM (#5793214)
you should learn about the angular concept of scope before gagging on this. its actually a very elegant mechanism for letting you treat a segment of the document as lexically scoped data within your Javascript.
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by nobleach on Thursday May 30, 2013 @12:08PM (#5793297)
I think he/she's going after the idea of polluting one's view with all sorts of non-standard markup invokes a gag reflex. I'm amazed that Google chose to adopt such an ugly non-standard idea. HTML5 does allow for data attributes, why on earth did Angular choose to ignore those? "ng-repeat", "ng-pooponastick" etc??? Most templating languages to not violate the actual HTML attributes to exploit their purposes. I'm not hating on Angular.js yet as I've yet to use it in a real project. But I'd hate to have to migrate a project from Angular to a more pure template.
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by WickyNilliams on Thursday May 30, 2013 @12:40PM (#5793521)
You can use data-* attributes in angular if you're not keen on invalid attributes e.g. data-ng-repeat. It used to be slightly broken, but I've been led to believe this is no longer the case.

As for making up your own elements as angular allows you to do, I think this is actually quite forward thinking. This is basically what the ShadowDOM[0] is all about, and when becomes common place you won't bat an eyelid seeing <NoBleachsSuperTag> in HTML.

[0] http://www.html5rocks.com/en/tutorials/webcomponents/shadowd...

Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by metaphorm on Thursday May 30, 2013 @12:41PM (#5793524)
angular allows you to prefix any html directive with "data-" to make it fully compliant with the html5 spec.

you can certainly use <li class="some_style_class" data-ng-repeat="comment in comments"> in your angular templates and have it pass a validator for html5 and still work with angular.

Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by jonursenbach on Thursday May 30, 2013 @12:27AM (#5790932)
Why?
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by MatthewPhillips on Thursday May 30, 2013 @12:29AM (#5790936)
Separation of concerns
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by eric_bullington on Thursday May 30, 2013 @12:39AM (#5790965)
The controller is in fact separated. The "ngController" you see referenced in the markup is the link between the view and the separate controller. Any MVC framework you could hold up as an example of proper "separation of concerns" will necessarily have the same link, even if it's implicit. Sometimes it's defined in the controller, sometimes the link is defined in the view, and sometimes you don't see it defined, but it's still there. (of course, we all know explicit is better than implicit)
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by MatthewPhillips on Thursday May 30, 2013 @12:48AM (#5790982)
Right, but doing it this way means both the view and the controller know too much. Why should a view know about how it is going to be used? Also, I'm guessing if you give this to a designer his/her eyes are going to glaze over.
Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by eric_bullington on Thursday May 30, 2013 @02:00AM (#5791162)
No, the link here is only in the view. The controller doesn't "know" about the view. This is opposite but functionally equivalent to have traditional server-side MVC frameworks handle this, which is to declare the view in the controller or the routing (which you can also do in AngularJS, you actually typically declare both the view and controller in the routing). But the point is, you have to declare the link somewhere. Declaring it in the view is no less proper than declaring it in the controller.

Having said all that, I'm really impressed with React and look forward to checking it out and using it in combination with Backbone. AngularJS definitely has its share of pain points. It's just that where the controller is linked to the view is not one of them.

(By the way, I'm upvoting you since I don't see anything particularly offensive or improper about your comment. We're just disagreeing. Not sure why you're being downvoted. )

Re:Facebook’s New React JavaScript Library Tutorial Rewritte... by davecap1 on Thursday May 30, 2013 @01:05AM (#5791017)
You don't actually ever need to explicitly specify the controller in Angular views. Usually in angular apps, the controller is specified by the routing provider (in JS), along with the view (template path).

In small examples (ie when not using angular routes) it is easier to explicitly specify the controller.