Live data from Hacker News

Diving into AngularJS

floatleft.com

41–48 of 48 posts

Re: Diving into AngularJS

#41

Earlier quoted context omitted.

Thanks for the feedback - I've been wondering about this for a while and you're right. It's just finding something that will work well!

This is a good survey of some of the beauties hidden in Google webfonts

* http://sachagreif.com/google-webfonts-that-dont-suck/

Re: Diving into AngularJS

#42
post #27

Earlier quoted context omitted.

Hey Kevin, this isn't about directives but about RESTful services and $resource. I started learning how to use AngularJS yesterday and all of the examples that I've found on it are confusing to me and seem to do it in different ways. I've seen somebody do it by calling myModule.factory. I've seen an example on Stackoverflow that says all you need to do is something like var Todo = $resource('/api/1/todo/:id');. I'm n…

Personally I found using $http less restrictive - there seem to be some edge cases where $resource behaves oddly. Ideally what you should be doing with REST calls is pushing them out to Angular Services ( http://docs.angularjs.org/guide/dev_guide.services.creating_... ) rather than making them directly in your controller. Here's a simple example: appServices.factory('Thing', function($http) { var Thing = function(dat…

Another nice feature of angular is that templates are promise-aware. So the following controller is equivalent for most purposes:

    function thingCtrl($scope, Thing) {
      $scope.things = Thing.all()
    }
    thingCtrl.$inject = ['$scope', 'Thing'];

Re: Diving into AngularJS

#43
post #37

I have been wondering if I should look into AngularJS but I'm a bit worried about it's future given Google also has Dart which seems to be competing with it, or am I wrong? We all know what Google is like when it comes to closing stuff down.

Angular is a front end JS framework. Dart is a language. So no, they are not competing.

I know Dart is a language, I have installed the Editor and played around with it, but it is all compiled to JavaScript (at least for anything except Dartium). I guess it is conceivable that Dart and Angular might be used together, not sure what the point would be though since Dart has the WebUI packages. Seems a bit simplistic to dismiss the idea there any overlap between these projects.

Re: Diving into AngularJS

#44
post #37

I have been wondering if I should look into AngularJS but I'm a bit worried about it's future given Google also has Dart which seems to be competing with it, or am I wrong? We all know what Google is like when it comes to closing stuff down.

It is "proper" open source with many enthusiastic non-google contributors.

Interesting point, had a look at the github page and looks really engaged, you've convinced me to try it out on a project. Thanks.

Re: Diving into AngularJS

#45

The more I use Angular, the more I love it. I like how it's really easy to get started with it. Just avoid writing your own directives right away, that's still the one part that is super confusing (although powerful).

What do you wish you knew about writing directives then that you know now? Or what did you find confusing? I am currently writing a book on Angular and would like to know. I remember I had a lot of trouble on how to write a reusable component defined in a partial, and what to pass into the directive constructor.

I too, tried to define a directive after the bootstrapping phase and couldn't figure out how.

I'd like to create a directive that would help me define directives. Sounds circular? I just want syntactic sugar to define 'components', in other words, to nicely package my code. I want to wrap together a piece of html, js and css under one name and invoke it as a HTML tag. That way I could better modularize my website. This needs to work in partials too.

What I don't like about Angular is that I's not easy to dynamically define/load stuff like directives and such. It all needs to be known beforehand, statically.

Re: Diving into AngularJS

#47
post #4

I tend to dive a lot into a source code when I am working with a library. You always have missing spots in documentation but you can actually know what's going on by reading the code. This is one of the reasons I am super comfortable with Backbone. However I cannot comprehend Angular's source code on github. Can anyone give me pointers on where to start reading it and/or how it's organized?

AngularJS source code is actually very read-able. You need a good CS background though. (There is even a parser in there!)

Re: Diving into AngularJS

#48
post #21

Why am I just noticing the "by Google" under the logo?!

That's actually one of the more interesting parts about Angular. I'm not sure of the details but I believe the Angular team have been counting on Object.observe for increasing the performance of the Angular code [0] (something that Google / the Chrome team have influence over). The Angular code you write now won't need to be updated and will get a great speed boost later. Other libraries, like Ember, get you to add a…

Actually, I'm sure it'll break a few things. Angular doesn't have a good concept of update granularity, which can be problematic when you get to the multi-directive interaction phase...
Post reply on HN