Alex
Member since May 3, 2016
- Profile: /members/13165-alex.htm
- Comments: 9
Recent Blog Comments By Alex
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 5, 2016 at 10:40 AM
@Ben, Agree, we're circling. :) But still disagree on the solution. I think you're trying to solve wrong problem, and it produces solution that is way too complicated to be universal, reliable and usable, but that's just my opinion and it can be wrong. May be it's worth to look at situation from di... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 5, 2016 at 8:42 AM
@Ben, Not really. I don't make such an assumption. The point is that if your control supports binding via ngModel then you're free to use it or not depending on your needs. But if you need such a support (and in my case I do) and component does not provide it - then you have a problem. :)... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 4, 2016 at 2:46 PM
@Ben, > To me, it seems like the "Angular" intent is to create components through Inputs and Outputs. Absolutely, we're disagree on that. :) Let's speculate a bit. What actually makes it possible to bind component using ngModel? It is value accessor. This is hard fact. Take a look at... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 4, 2016 at 9:11 AM
@Ben, > Doesn't this *force* you to use ngModel? Meaning, how could you then use your widget outside of an ngModel context? As I said you can make them @Optional(). This way if you don't provide ngModel outer binding then it will just not be injected in your component. In the component, all you... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 4, 2016 at 9:05 AM
@Ben, You mean like this: https://plnkr.co/edit/pA1xY7Vq0GfylcRvs4m4 ? But this way component will not be even compatible with ngModel. > But, in your example, you are basically are forcing the target component (Toggler) to know about both ngControl and the TOGGLE_EVENT. True. But they are int... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 3, 2016 at 11:52 PM
Here is the plunker: https://plnkr.co/edit/KnuEkeisEMW5De74yi08?p=preview It is in typescript since we're using it widely at work, but it should be pretty straightforward how to translate it into plain javascript. Also it is very simple which should also help to understand it. I put lot of comments... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 3, 2016 at 10:26 PM
@Ben, While I'm fighting plunker :) I can give you a couple of hints where to look. First - you don't need OnChanges. Second and most important - regardless of how weird it sounds - you *should not* expose your editing model from control directly together with updating event. Yes, I meant exactly *... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 3, 2016 at 4:25 PM
@Ben, Well, one thing angular taught me in general that if you're writing a lots of code for something pretty small then you're going in terribly wrong direction regardless of considering anything else. :) Also looks like I did not make myself clear enough, sorry for that. May be I got it wrong, ... read more »
-
Manually Triggering ngOnChanges() Inside An NgModel Value Accessor In Angular 2 Beta 11
Posted on May 3, 2016 at 2:07 PM
Hey @Ben, You're very right about how wrong you are. :) You don't need pretty much all that scary stuff you wrote. Basically all you need is to two things. 1) Implement value accessor and inject external event into it which will be source of changes. Then inject the same event into component and ... read more »