Live data from Hacker News

Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

medium.com

21–30 of 56 posts

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#21

I've been using Angular recently and love it. But this example is not matched evenly with the modular component demonstration of the React tutorial. The equivalent in Angular would be to use directives ( http://docs.angularjs.org/guide/directive ) for the comment list, each comment, and each part of a comment. Passing data between parent and child components (via scope) becomes a little tricky.

I am relatively new to Angular, but wouldn't you want to have the comments be a Factory using ngResource? If the comments are restful then it seems much easier.

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#22
I would like to see a similar tutorial which also covers authentication and how to add security to your app. There are a few but I want to see a really simple one.

What I don't understand is how you add login while keeping your REST backend stateless. How do you validate the request and make sure that it comes from the correct user and not just someone who forges the request without keeping a state on the server-side? Normally you just add a session.

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#23
post #22

I would like to see a similar tutorial which also covers authentication and how to add security to your app. There are a few but I want to see a really simple one. What I don't understand is how you add login while keeping your REST backend stateless. How do you validate the request and make sure that it comes from the correct user and not just someone who forges the request without keeping a state on the server-side…

This seems to explain how to do it pretty well using angular.

http://www.frederiknakstad.com/authentication-in-single-page...

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#24
post #22

I would like to see a similar tutorial which also covers authentication and how to add security to your app. There are a few but I want to see a really simple one. What I don't understand is how you add login while keeping your REST backend stateless. How do you validate the request and make sure that it comes from the correct user and not just someone who forges the request without keeping a state on the server-side…

There's a bunch of different ways to do this. For Instagram we use Django's normal login mechanisms which add a session cookie. Our calls to the REST backend include this cookie. It works pretty well for us.

I think Facebook.com does something similar.

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#26
post #22

I would like to see a similar tutorial which also covers authentication and how to add security to your app. There are a few but I want to see a really simple one. What I don't understand is how you add login while keeping your REST backend stateless. How do you validate the request and make sure that it comes from the correct user and not just someone who forges the request without keeping a state on the server-side…

Our web application / REST API actually uses two systems; for employees, it uses HTTP basic authentication, which is validated to LDAP via Spring Security. For customers, there's a security proxy in between the front-end and our API (IBM's WebSeal), so authentication's handled completely outside of our REST API.

Just a couple ideas.

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#27

I've been using Angular recently and love it. But this example is not matched evenly with the modular component demonstration of the React tutorial. The equivalent in Angular would be to use directives ( http://docs.angularjs.org/guide/directive ) for the comment list, each comment, and each part of a comment. Passing data between parent and child components (via scope) becomes a little tricky.

I am relatively new to Angular, but wouldn't you want to have the comments be a Factory using ngResource? If the comments are restful then it seems much easier.

Theoretically yes, but ngResource is kind of the achilles' heel of AngularJS right now. You're often better off using a different library or making your own class with $http requests.

Re: Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

#30
post #27

Earlier quoted context omitted.

I am relatively new to Angular, but wouldn't you want to have the comments be a Factory using ngResource? If the comments are restful then it seems much easier.

Theoretically yes, but ngResource is kind of the achilles' heel of AngularJS right now. You're often better off using a different library or making your own class with $http requests.

Could you elaborate why it's the achilles' heel? I'm exploring AngularJS right now, and am interested in its pitfalls
Post reply on HN