Ward Bell
Member since Feb 5, 2015
- Profile: /members/12524-ward-bell.htm
- Comments: 18
Recent Blog Comments By Ward Bell
-
Host Bindings Are Breaking The ngModel Bridge In Angular 2 Beta 11
Posted on Mar 25, 2016 at 3:08 PM
Hi Ben - I converted your sample to TypeScript and then re-implemented in a different direction in which I forget about `[(ngModel)]` and create my own 2-way binding property, `[(toggle)]`. No need for the custom ValueAccessorDirective in the middle which seems to play a role in your host update ... read more »
-
Experimenting With The .catch() Operator And Stream Continuation In RxJS And Angular 2
Posted on Mar 13, 2016 at 12:13 AM
Fascinating (to me). Among other things, I think you are saying that there is no difference between `.catch(()=>stream)` and `.retry()`. Is that correct. Of course you can do different things with the two methods. The catch affords error interpretation and stream manipulation; the retry can set ... read more »
-
Ward Bell: Do Not Expect EventEmitter To Be Observable In Angular 2
Posted on Mar 9, 2016 at 1:08 AM
I think you want `subject.onCompleted();`... read more »
-
Ward Bell: Do Not Expect EventEmitter To Be Observable In Angular 2
Posted on Mar 8, 2016 at 5:31 PM
The `catch` is just another operator in the observable chain. It doesn't make the stream "hot". That's why you only got those errors going when you subscribed. Too separate concerns. The `catch` operator takes the flow off the "sad path" and puts it back on the "happy path... read more »
-
Ward Bell: Do Not Expect EventEmitter To Be Observable In Angular 2
Posted on Mar 8, 2016 at 3:12 PM
Not sure if I should be honored or frightened to see my name attached to your post. ;-) It's great that you're exploring RxJS. It is the new hotness. It's a big, complex API too. Scares me but I'm learning. A few thoughts: I didn't see anything in your example that consumed the `errors` stream; o... read more »
-
Logging Error Streams To The Server In Angular 2 Beta 6
Posted on Mar 7, 2016 at 2:59 AM
Aaargh! Don't use EventEmitter for this purpose. See my response to your prior post. EvE will not be an observable in future. Use the RxJS `Subject` instead.... read more »
-
EventEmitter Is An RxJS Observable Stream In Angular 2 Beta 6
Posted on Mar 7, 2016 at 2:56 AM
Do NOT count on EventEmitter continuing to be an Observable! Do NOT count on those Observable operators being there in the future! These will be deprecated soon and probably removed before release. Use EventEmitter only for event binding between a child and parent component. Do not subscribe to i... read more »
-
I Have A Fundamental Misunderstanding Of Change Detection In Angular 2 Beta 8
Posted on Mar 7, 2016 at 2:33 AM
My "solution" in a plunker: http://plnkr.co/edit/xm50CY5uePYC6mJddwAu?p=preview BTW, the reason that setTimeout works is because it waits one cycle before updating the parent `viewCount`. Waiting means it doesn't violate the unidirectional flow rule.... read more »
-
I Have A Fundamental Misunderstanding Of Change Detection In Angular 2 Beta 8
Posted on Mar 7, 2016 at 12:13 AM
Hi Ben. Sorry for the frustration on this point. FWIW, I confronted your particular issue long ago when I wrote the sample for the "Lifecycle Hooks" chapter. I wanted to display on screen when Angular calls the `OnViewChecked` hook. Got the same error. Had to come up with a workaround.... read more »
-
Rendering Image Previews Using Object URLs vs. Base64 Data URIs In AngularJS
Posted on Dec 4, 2015 at 4:05 PM
Nice. Thanks also for drawing my attention to Plupload ( http://www.bennadel.com/blog/2652-using-plupload-to-upload-files-in-angularjs.htm ) as I can't imagine how I'd handle that part myself. Fun to see you componentizing your A1. Migrating it to A2 shouldn't be too hard when the time comes.... read more »
-
Overriding Core And Custom Services In AngularJS
Posted on Oct 8, 2015 at 1:08 AM
The service-definition-replacement technique you describe here is one of my favorite ways to replace services with mocks, especially when I'm mocking that thing repeatedly across many test suites. A good example is a logger service that presents popup toasts (John Papa's toastr). I don't want to se... read more »
-
Overriding Directive Definitions In AngularJS
Posted on Oct 6, 2015 at 1:42 PM
Opens up the world of directives, doesn't it! :-) This is exactly what I was talking about on that podcast, Ben. But I was waving my arms in the air as if people could see me and never got around to writing it down. You've done a great job of laying it out clearly so people can benefit. Kudos!... read more »
-
Revisiting Routing, Nested Views, And Caching With ngRoute In AngularJS 1.x
Posted on Mar 26, 2015 at 3:43 PM
Hi Ben! Thanks for taking the time to respond to my comment. I've had the following response on my desk for a week or two and forgot I hadn't posted it :( Hope it's still relevant. We may be just talking to each other ... but we're having a good time doing it. Exchanging views like this helps me d... read more »
-
Revisiting Routing, Nested Views, And Caching With ngRoute In AngularJS 1.x
Posted on Mar 16, 2015 at 9:00 PM
Hi Ben - Fascinating ... as always. Your post is most interesting to me for the way it calls attention to a number of routing issues that people don't discover for themselves until perhaps too late. Top of the list is what I perceive as a cry for "**life-cycle events**". They are the *... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 10, 2015 at 1:40 PM
Well you can still do it their way and return the promise if you want: var promise; try { . . . // ... . . . promise = when(...); } catch ( error ) { . . . promise = obj.reject( error ); . . . $exceptionHandler( error ); } finally { . . . return promise; } I think we beat this horse to death ??... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 9, 2015 at 12:37 PM
Well done, @gleb. That's a good post for folks who want to understand promise error scenarios and how to handle them. I do miss some of Q.js niceties from $q. The ability to extend $q is a lesson worth learning and I'm happy to learn of libraries that do that. Incidentally, one advantage of $q (re... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 6, 2015 at 4:17 PM
Thanks, Ben. I had not issue with the first try/catch ... understood the intent there. My question concerned the second try/catch (the one within the first catch). I see that you are copy something you saw in Angular code. I'm trying to imagine the purpose of it and learn something that I must admi... read more »
-
Monkey-Patching The $q Service Using $provide.decorator() In AngularJS
Posted on Feb 5, 2015 at 7:38 PM
Why bother with all of the code in the catch block? `$q.when` catches anything bad that happens asynchronously, Anything that goes wrong in the synchronous code (the code in your `try` block) can be caught and returned in a rejected promise like this: `catch(error) { return $q.reject( error ) );`... read more »