This is actually great for someone learning Angular. It's just a different way of presenting the exact same material. I was completely dumbfounded at first when learning Angular. This would have helped. I very much suggest everyone interested in Angular development to read what the guys at MeanJS.org[1] have to say about structuring modules. It helps me think about my app a lot better. The structure could be cleaned…
Classy: Cleaner class-based controllers for AngularJS
41–50 of 59 posts
Re: Classy: Cleaner class-based controllers for AngularJS
#42Re: Classy: Cleaner class-based controllers for AngularJS
#43I've experienced the problem of unwieldy controllers myself, but angular is already such an intricate, opinionated framework that I can't imagine adding another layer with its own DSL. Good code organization solves a lot of these problems.
I've noticed that particularly in web development there is this trend of writing - and using - countless frameworks that add much more complexity with little gain, and where the response to existing complexity is to... add more of it. IMHO that doesn't seem like a very good way of doing things, since now you have to learn not only JS, but also all these extra indirections piled on top, to understand how your web appl…
Re: Classy: Cleaner class-based controllers for AngularJS
#44There is really no need for this. It adds nothing imo but another layer of sauce over what angular already does properly. If your controllers are getting huge, go refactor into directives and services. I don't see how this would help since there isn't even inheritance? also: app.controller('AppCtrl', ['$scope', '$location', '$http'], function($scope, $location, $http) { // ... }]); vs app.classy.controller({ name: 'A…
Look a little closer - It's not about saving bytes. I ended up coming up something very similar for my projects and it made a notable difference in defect rate. - Removes the need for positional arguments for constructor injection, so you only have to list your dependencies once. This one seems minor but can be a major frustration and a source of bugs when working with lots of services. - Moves actions out of the sco…
Based on the Classy's docs, it doesnt "move" actions out of the scope and onto the controller, but the other way around. It adds controller's actions to the scope unless you prefix the names with an underscore.
Based on my experience debugging angular performance issues associated with expensive $digest cycles, I do NOT WANT it to happen automagically. I only want those functions on the scope that i explicitly place there.
Re: Classy: Cleaner class-based controllers for AngularJS
#45This is actually great for someone learning Angular. It's just a different way of presenting the exact same material. I was completely dumbfounded at first when learning Angular. This would have helped. I very much suggest everyone interested in Angular development to read what the guys at MeanJS.org[1] have to say about structuring modules. It helps me think about my app a lot better. The structure could be cleaned…
I would go with writing directives over using global scope in general, though it's more time consuming to me.
I haven't found out how to do this yet. Not fixing it until it breaks, even if that means I'll have to re-write parts of the app.
Re: Classy: Cleaner class-based controllers for AngularJS
#46This is actually great for someone learning Angular. It's just a different way of presenting the exact same material. I was completely dumbfounded at first when learning Angular. This would have helped. I very much suggest everyone interested in Angular development to read what the guys at MeanJS.org[1] have to say about structuring modules. It helps me think about my app a lot better. The structure could be cleaned…
TLDR; THANK YOU (Intermediary AngularJS learning–curve is friggin hard.)
Re: Classy: Cleaner class-based controllers for AngularJS
#47This is actually great for someone learning Angular. It's just a different way of presenting the exact same material. I was completely dumbfounded at first when learning Angular. This would have helped. I very much suggest everyone interested in Angular development to read what the guys at MeanJS.org[1] have to say about structuring modules. It helps me think about my app a lot better. The structure could be cleaned…
I just want to let you know that I really appreciate your empathetic suggestions for those [like me] trying to learn intermediary aspects of AngularJS; of which I am going to relate to—the learning of how to walk——and then applying that knowledge to break atmo and venture into the stars. :) TLDR; THANK YOU (Intermediary AngularJS learning–curve is friggin hard.)
Re: Classy: Cleaner class-based controllers for AngularJS
#48Oh wow, this is my little project, cool to see it on the front page of Hacker News. :-)
Re: Classy: Cleaner class-based controllers for AngularJS
#49Earlier quoted context omitted.
Look a little closer - It's not about saving bytes. I ended up coming up something very similar for my projects and it made a notable difference in defect rate. - Removes the need for positional arguments for constructor injection, so you only have to list your dependencies once. This one seems minor but can be a major frustration and a source of bugs when working with lots of services. - Moves actions out of the sco…
"- Moves actions out of the scope and onto the controller itself, where they belong" Based on the Classy's docs, it doesnt "move" actions out of the scope and onto the controller, but the other way around. It adds controller's actions to the scope unless you prefix the names with an underscore. Based on my experience debugging angular performance issues associated with expensive $digest cycles, I do NOT WANT it to ha…
Re: Classy: Cleaner class-based controllers for AngularJS
#50There is really no need for this. It adds nothing imo but another layer of sauce over what angular already does properly. If your controllers are getting huge, go refactor into directives and services. I don't see how this would help since there isn't even inheritance? also: app.controller('AppCtrl', ['$scope', '$location', '$http'], function($scope, $location, $http) { // ... }]); vs app.classy.controller({ name: 'A…
Thanks for the feedback. I would argue that the Classy example is more expressive and crucially it is DRY. Edit: > One of the brilliant things about angular is that it provides a proper structure that anyone that needs to write angular needs to adhere to Angular doesn't provide structure for controllers, they are just javascript functions. If you want to add structure it is up to the individual developer to decide ho…