I'm not sure if I'm more excited or creeped out. Yesterday, I decided I wanted to learn Angular and I figured making a fantasy football clone would be a fun, interesting way to do it -- something I'm vaguely passionate and vaguely knowledgeable about, something that isn't a Twitter clone, lots of numbers, something I can show to a few friends without having their eyes glaze over.
Then this came out. Super excited for the weekend so I can dive on through. Thanks, Matt -- but stop reading my mind.
(n.b.: I'd be more than willing to pay sticker price if I could get a physical copy instead. I know it's lame, and slightly more effort, but I don't have a monitor setup at the moment so I'd rather leaf through a book than scroll through an alt-tabbed .pdf.)
Ditto for paying for a print copy. Some tech books I'd rather read outside in the sun; it forces me to actively try to internalize more instead of hopping to/from the console every minute.
Agreed with the 'reading my mind part'. Though it is high time for fantasy season so its probably at the front of everyone's mind right now. Anyway, very excited to get into this.
Hey all - we'd love to hear any questions, criticism, or ideas you have.
Also, we have a pdf version of the ebook available for $25 on the site, but we'd like to give all of you on HN a 20% discount. You can go to this URL to get the cheaper price - http://gum.co/SUry/awesomehners
Like I said in another comment, the git clone command should be fixed to use https instead of ssh. That way it would be able for users that have no access to the repository (almost anyone) to clane it without any problems.
There's also: yearofmoo [0], the AngularJSLearning Index [1], David Mosher [2], tutorialzine [3], and the ng-newsletter. [4] I would like to see the Integration With Other Languages/Frameworks section expanded (D3, PouchDB, etc). Are you guys planning on expanding on that?
I get a lot of requests to expand the tutorial with other frameworks, as you mentioned. Ultimately, the tutorial itself will be structured in a way that allows for the best presentation of concentrated learning. However, this doesn't mean that we won't be releasing other content covering integration with other frameworks.
Working with a large Angular app, I've found it much nicer to split away from the "Rails"-style convention of grouping by type (controllers, models, etc) and instead grouping by modules. This plays especially well with Angular where you can group everything within a module together and include a single module which ties all the dependencies together.
Curious if others do something similar and group code together by modules or does everyone group by type?
I recently spent days writing AngularJS app and I came to same conclusion that I should have split the app into modules.
Even though the style of grouping together Controllers and Services works well, it still won't be easy to maintain when the size of app grows big.
I'm always excited to structure my projects in a different more effective way - well, it's more of a struggle - anyway, this sounds interesting. Can someone elaborate on the file structure and structure of files and the way they connect?
I'm rolling with a MVP structure that frankly is becoming cumbersome with my current project's size.
I do it the way you just mentioned. I create specific modules and have them inject their dependencies. Each modules I create has its one or more models within its domain. I was going to go the repository route (one module per type) but it seemed overkill.
For front-end such as Angular I always group in modules, usually nested modules for larger apps. For back-end systems sometimes type makes more sense, especially when the app grows quite big and uses a layered architecture.
I'm still not convinced about Angular's Dependency Injection thing. The problems it allegedly solves don't clearly outweigh the ones it certainly creates.
It claims to provide concern isolation, which facilitates testing and cleanliness. I don't think it helps that much.
But it has a middle-stage learning curve, more callbacks than I'd like, and implicitness of dependencies. For example, i.e. you need to know what $scope-like params are "supposed to contain" on every function that uses them.
Also, I find the naming spotty: "directive", "module", "injector", "compile" etc. lack specificity. They are not as bad as "Manager", "Data", "Info" and "Object", but they are not good.
For example, i.e. you need to know what $scope-like params are "supposed to contain" on every function that uses them.
You should never write code that communicates through $scope objects and expects certain values to be set. The only exception to this is the relationship between views and their respective controllers.
Outside of the controller-view relationship, nothing in AngularJS requires passing data in $scope objects, and you definitely shouldn't.
Why do you think dependency injection doesn't help exactly? I personally don't know of any other pattern to effectively test/mock things like HTTP interactions. It's also a pattern that's used by many, many other languages and frameworks - what's the alternative you're thinking about?
The tutorial recommends starting your server using `node server`.
With MEAN a Grunt file is provided. Running the server with `grunt` will make grunt run the server and then watch the directory for changes - restarting the server and refreshing the page as necessary.
I tried to use grunt as you say with the tutorial, but it didn't work. They say they are using a stripped down version of MEAN, so maybe they took that out? Do you know a good tutorial on adding it back in, as I like the sound of the functionality you're talking about...
To add on to what mfrisbie said: If you want a good 3rd party opinion on the quality of the tutorial, you might want to see what Brad Green (the guy who manages the AngularJS team at Google) has to say about it - https://twitter.com/bradlygreen/status/373134106936090624
Javascript is a harder language then most web development languages when you really get into it (OOP, inheritance, scope, first class functions, callbacks, closures, compile time errors). If you go into it thinking your going to save brain power you may be in for a rude awakening.
The advantage is you can do real time async stuff a lot better then with other frameworks.
I've just kicked off my latest project using the MEAN stack.
The main advantage for using the stack has been a huge time saving in getting the project set up. NodeJS and express is hugely flexible about how you structure your source, which can also be a downfall in the additional mental load of deciding where stuff should go. MEAN does this for you.
The disadvantage has been where I want to do things differently from how MEAN is set up. For example, MEAN uses Bootstrap v2, I wanted Bootstrap v3. It was a slight faff updating it. It would probably be harder if you eg. wanted to use MySQL instead of MongoDB.
There is still a lot that you need to learn before you will get an app fully up and running, but with MEAN you can get cracking on stuff before you know it all. I don't know anything about Grunt yet, but can still use the Grunt file provided to run the server.
It's super simple to set up. We're actually thinking of doing a Firebase version of our tutorial, as there would be no local set up (other than hosting the static files).
Will you be covering security in any detail? Most people seem to miss this and I'm discouraged to see when I download the MEAN project this is based on it has serious security flaws.
For example, if you view the articles list at /#!/articles and make a note of any article ID, then visit /article/<article_id> it will return the article author's hashed password, salt and email address in addition to the article content. This also works while logged out. Kinda scary if people are using this as a template for their own apps.
Yeah that freaked me out too. I'm not super familiar with mongoose either so at the time I couldn't figure out how to leave them out of serialization always. I could do it for one-off calls but there should be a way to generally whitelist I'd think.
The best place I have found to learn about Angular is http://egghead.io . The videos are really clear and concise.
Many of the more confusing Angular fundamentals that many tutorials like these don't stress egghead.io has short 2 to 3 minute videos explaining in very clear terms.
PS. I know I sound like a shill, but I have nothing do with egghead.io other then I've found them immensely useful.
Kind of surprised how in depth the tutorial goes, but only manages to mention the word "test" once and doesn't cover the fantastic testing back end included with the AngularJS seed (https://github.com/angular/angular-seed).
Unless the person learning AngularJS has never done any automated testing before, I can't see any reason why not to be using tests as a tool to further your own learning. I learned Go last year relying heavily on tests, first specifying what I wanted to achieve in a high level test, then learning as I figured out how to make the test pass.
Nice tutorial. One critique is the use of the "ng" prefix for your app's modules, which I believe is discouraged by the angular core developers since it's supposed to denote core angular functionality.
Looks like a solid walk through of building an angular app.
OT but the fantasy football twist is great. I only just started playing this year so I've been learning a lot. We're playing the uk version but I guess it's much the same. I've found it interesting how much strategy there is and how much data I can analyse.
We have a startup in the construction industry so wanted to use it as a tool for keeping a sort of weekly offline / banter conversation going on with clients. Turns out that I actually enjoy too!
Nice work! I love how all the individual components are one big scrollspy. We (Coursefork) had a call with Eric yesterday to figure out how to make this kind of material "forkable", but something we didn't talk about was this idea of charging for the "source source code". What exactly does that mean?
This looks very interesting, thanks for sharing. I especially like that you decided to go with a fantasy football app - can't say I've seen many tutorials do that ;) And last but not least, I like that you chose the MEAN stack, for no reason other than I am unfamiliar with it and have been meaning to look into it.
[+] [-] jmduke|12 years ago|reply
Then this came out. Super excited for the weekend so I can dive on through. Thanks, Matt -- but stop reading my mind.
(n.b.: I'd be more than willing to pay sticker price if I could get a physical copy instead. I know it's lame, and slightly more effort, but I don't have a monitor setup at the moment so I'd rather leaf through a book than scroll through an alt-tabbed .pdf.)
[+] [-] aray|12 years ago|reply
Maybe http://lulu.com ?
[+] [-] victoro|12 years ago|reply
[+] [-] ericmsimons|12 years ago|reply
Also, we have a pdf version of the ebook available for $25 on the site, but we'd like to give all of you on HN a 20% discount. You can go to this URL to get the cheaper price - http://gum.co/SUry/awesomehners
Thanks for all of your support!
[+] [-] Omnipresent|12 years ago|reply
[+] [-] JelteF|12 years ago|reply
[+] [-] matt_|12 years ago|reply
[+] [-] jjsz|12 years ago|reply
[0] http://www.yearofmoo.com/
[1]https://github.com/jmcunningham/AngularJS-Learning,
[2] http://www.youtube.com/user/vidjadavemo/videos
[3] http://tutorialzine.com/2013/08/learn-angularjs-5-examples/
[4] http://www.ng-newsletter.com/posts/beginner2expert-how_to_st...
[+] [-] mfrisbie|12 years ago|reply
[+] [-] jjsz|12 years ago|reply
[+] [-] davidwparker|12 years ago|reply
Curious if others do something similar and group code together by modules or does everyone group by type?
[+] [-] Rodeoclash|12 years ago|reply
[+] [-] p3rs3us|12 years ago|reply
[+] [-] joevandyk|12 years ago|reply
Bugs me to have the order logic spread out in the views, models, controllers, hepers, libs, etc folders.
[+] [-] babby|12 years ago|reply
I'm rolling with a MVP structure that frankly is becoming cumbersome with my current project's size.
[+] [-] mac1175|12 years ago|reply
[+] [-] t0mas88|12 years ago|reply
[+] [-] ganarajpr|12 years ago|reply
Oh between I do group by Type inside of a module.
[+] [-] glazskunrukitis|12 years ago|reply
[+] [-] BlackJack|12 years ago|reply
[+] [-] otikik|12 years ago|reply
It claims to provide concern isolation, which facilitates testing and cleanliness. I don't think it helps that much.
But it has a middle-stage learning curve, more callbacks than I'd like, and implicitness of dependencies. For example, i.e. you need to know what $scope-like params are "supposed to contain" on every function that uses them.
Also, I find the naming spotty: "directive", "module", "injector", "compile" etc. lack specificity. They are not as bad as "Manager", "Data", "Info" and "Object", but they are not good.
[+] [-] Nitramp|12 years ago|reply
Outside of the controller-view relationship, nothing in AngularJS requires passing data in $scope objects, and you definitely shouldn't.
Why do you think dependency injection doesn't help exactly? I personally don't know of any other pattern to effectively test/mock things like HTTP interactions. It's also a pattern that's used by many, many other languages and frameworks - what's the alternative you're thinking about?
[+] [-] weavie|12 years ago|reply
With MEAN a Grunt file is provided. Running the server with `grunt` will make grunt run the server and then watch the directory for changes - restarting the server and refreshing the page as necessary.
Much easier.
[+] [-] nekopa|12 years ago|reply
[+] [-] Geee|12 years ago|reply
[+] [-] ericmsimons|12 years ago|reply
[+] [-] mfrisbie|12 years ago|reply
[+] [-] mmanfrin|12 years ago|reply
[+] [-] mfrisbie|12 years ago|reply
[+] [-] metastew|12 years ago|reply
That being said, I'm curious if there are other advantages to learn the MEAN stack?
[+] [-] wavesounds|12 years ago|reply
The advantage is you can do real time async stuff a lot better then with other frameworks.
[+] [-] weavie|12 years ago|reply
The main advantage for using the stack has been a huge time saving in getting the project set up. NodeJS and express is hugely flexible about how you structure your source, which can also be a downfall in the additional mental load of deciding where stuff should go. MEAN does this for you.
The disadvantage has been where I want to do things differently from how MEAN is set up. For example, MEAN uses Bootstrap v2, I wanted Bootstrap v3. It was a slight faff updating it. It would probably be harder if you eg. wanted to use MySQL instead of MongoDB.
There is still a lot that you need to learn before you will get an app fully up and running, but with MEAN you can get cracking on stuff before you know it all. I don't know anything about Grunt yet, but can still use the Grunt file provided to run the server.
Well worth using in my opinion.
[+] [-] ericmsimons|12 years ago|reply
[+] [-] thomc|12 years ago|reply
Will you be covering security in any detail? Most people seem to miss this and I'm discouraged to see when I download the MEAN project this is based on it has serious security flaws.
For example, if you view the articles list at /#!/articles and make a note of any article ID, then visit /article/<article_id> it will return the article author's hashed password, salt and email address in addition to the article content. This also works while logged out. Kinda scary if people are using this as a template for their own apps.
[+] [-] bemurphy|12 years ago|reply
[+] [-] mfrisbie|12 years ago|reply
[+] [-] elbac|12 years ago|reply
Many of the more confusing Angular fundamentals that many tutorials like these don't stress egghead.io has short 2 to 3 minute videos explaining in very clear terms.
PS. I know I sound like a shill, but I have nothing do with egghead.io other then I've found them immensely useful.
[+] [-] mfrisbie|12 years ago|reply
[+] [-] pmtarantino|12 years ago|reply
[+] [-] WalterSear|12 years ago|reply
[+] [-] beefsack|12 years ago|reply
Unless the person learning AngularJS has never done any automated testing before, I can't see any reason why not to be using tests as a tool to further your own learning. I learned Go last year relying heavily on tests, first specifying what I wanted to achieve in a high level test, then learning as I figured out how to make the test pass.
[+] [-] mfrisbie|12 years ago|reply
[+] [-] marknutter|12 years ago|reply
[+] [-] aidos|12 years ago|reply
OT but the fantasy football twist is great. I only just started playing this year so I've been learning a lot. We're playing the uk version but I guess it's much the same. I've found it interesting how much strategy there is and how much data I can analyse.
We have a startup in the construction industry so wanted to use it as a tool for keeping a sort of weekly offline / banter conversation going on with clients. Turns out that I actually enjoy too!
[+] [-] arms|12 years ago|reply
- [1] http://www.thinkster.io/pick/sFObNwt4rA/angularjs-built-in-f...
[+] [-] arms|12 years ago|reply
[+] [-] martindale|12 years ago|reply
[+] [-] arms|12 years ago|reply