Martin Hochel
Member since Aug 20, 2015
- Profile: /members/12791-martin-hochel.htm
- URL: http://ngparty.cz
- Comments: 15
Recent Blog Comments By Martin Hochel
-
HTTP Requests Are Cold / Lazy Streams In Angular 2 Beta 6
Posted on Feb 28, 2016 at 9:37 AM
afaik all observables ( Rx ) are lazy, and that's a good thing. You have explicit control over them, which you don't get with Promises for example. What Rob meant by saying HTTP streams are cold, is imo that they are implemented as "cold observables". There are hot and cold observables... read more »
-
Understanding The Role Of Static Methods In An Angular 2 Dependency-Injection Context
Posted on Feb 28, 2016 at 8:14 AM
Hi Ben, again nice deep overview about more, kind of complex, ng2 behind the scenes concepts. Providing a class constructor for ng2 DI is a no brainer, because ng2 is so awesome :) I've created a plunk to demonstrate http://plnkr.co/edit/z0uYfrJw5yfuFMW7kgHY?p=preview... read more »
-
Component Life-Cycle Methods Need To Be Defined On The Prototype In AngularJS 2 Beta 1
Posted on Jan 25, 2016 at 4:33 PM
@Ben, hehe yeah, well bundle is just readable like, mmm, well ... bundle :D but I completely understand your reasoning to stick with es5 for now. But trust me, once you start with ES6, you'll never look back ;)... read more »
-
Component Life-Cycle Methods Need To Be Defined On The Prototype In AngularJS 2 Beta 1
Posted on Jan 25, 2016 at 3:39 PM
Hey Ben, again great post! Here is explanation why it checks for life cycle methods on prototype. Whole( I mean a lot of ) angular 2 relies on decorators. In class decorators you don't get access to instance types, only yourClassConstructorFunction.prototype are available, so that's the main rea... read more »
-
Formatting And Parsing Custom ngModel Bindings In AngularJS
Posted on Dec 2, 2015 at 3:54 PM
@Ben, sorry for the delay, here is basic example: http://plnkr.co/edit/S568Dk7RGoNW4Cm6mVvC?p=preview tl;dr always angular.copy to break the references and to provide new reference for ngModel.... read more »
-
Formatting And Parsing Custom ngModel Bindings In AngularJS
Posted on Nov 30, 2015 at 5:07 PM
Ben, just bravo! Also using ng-model is very useful for passing data model binding to your component if you wanna provide one way data flow. $render( instead of $scope.$watch and within, setting your internal property with angular.copy(viewValue)) + $setViewValue for manually controlled update t... read more »
-
Creating An Isolate-Scope Directive With Multiple Transclusion Points In AngularJS
Posted on Oct 19, 2015 at 11:08 AM
@Ben, wow thanks! I'm glad it was helpful :)... read more »
-
Handling Window Blur And Focus Events In AngularJS
Posted on Oct 19, 2015 at 10:53 AM
@Ben, yup exactly, I've also used $apply for situations like in your example and because $evalAsync just wasn't there. thanks for chat! I love your posts and hope that one day I'll be able to buy you a beer for your effort to the community. cheers!... read more »
-
Creating An Isolate-Scope Directive With Multiple Transclusion Points In AngularJS
Posted on Oct 18, 2015 at 5:26 PM
Interesting approach Ben. I think your approach is way to complicated. Check this out: https://www.airpair.com/angularjs/posts/creating-container-components-part-2-angular-1-directives#making-it-reusable just simple service implementation. anyway it has already landed to angular repo https://... read more »
-
Handling Window Blur And Focus Events In AngularJS
Posted on Oct 15, 2015 at 8:52 AM
and of course, $evalAsync works :) // your code but $evalAsync instead of $apply http://codepen.io/Hotell/pen/MaEXGM?editors=101 // demo showcase http://s.codepen.io/Hotell/debug/MaEXGM?... read more »
-
Handling Window Blur And Focus Events In AngularJS
Posted on Oct 15, 2015 at 8:38 AM
@Ben, haha, yes I am aware of everything you said master! :) $scope.$apply is not always the best choice because the dirty checking has to run through whole scope tree, which may be slow in some cases :) In some cases scope.$digest is sufficient. That was my point.... read more »
-
Handling Window Blur And Focus Events In AngularJS
Posted on Oct 14, 2015 at 7:58 AM
very cool Ben! as always :) Maybe you can use just scope.$evalAsync( attributes.bnWindowBlur ); or just scope.$eval() instead of $apply. $apply is $EVIL! :)... read more »
-
Creating A ReactJS-Inspired "Props" Object In AngularJS
Posted on Aug 31, 2015 at 8:41 AM
@Ben, yes the view can access the state. It's defined as private just explicitly disable to set state directly from link function or from some other directive, which requires that component/directive. All in all that's just typescript so the state is publicly available on the scope.ctrl namespace... read more »
-
Creating A ReactJS-Inspired "Props" Object In AngularJS
Posted on Aug 28, 2015 at 11:45 AM
Again very interesting idea Ben. ReactJs is super cool(expect the jsx abomination imho) and we can definitely learn a lot from it. I'm doing something similar, angular via "reactJS" api style. So state ( vm ) props are strictly on this.state and you are using bindToController to get prop... read more »
-
TypeError: Cannot Read Property "childNodes" Of Undefined In AngularJS
Posted on Aug 20, 2015 at 1:06 PM
Hi Ben, very interesting bug indeed. You should implement custom directive for these kinds of script/css lazy loading, because as you mentioned dom manipulation in controller is a BIG no no :) I've created jsbin as a showcase: https://jsbin.com/kazohu/edit?html,js look particulary at myLoadScri... read more »