Hi Sander, As always thanks for the informative response!
Your solution is close to what I am needing and it could probably work with some tweaking. In your example, I wouldn't really need to call the next function on the observable as I just need to determine when the array length equals 3 and then call the function. I tried subscribing to the Subject and then pushing to the array and when the array's length equals the required number, execute the function. One issue with subscribing to the Subject is that the @Input() values get set before the ngOnInit() gets called, which is where I was placing the subscribing function- so that doesn't work. I could place the subscribing function in one of the @Input() setters, however, if that isn't the first one to get called, then the array length will never equal what I need it to in order to execute the function. So, I imagine a quick and dirty solution is just to push some value to an array via a function in each @Input() setter and then when the array.length equals the required length, execute the function. Ideally, I was wondering if there was a more elegant or better practice way of doing it, but at the end of the day, this should work. What do you think? Thanks! Scott On Sunday, January 27, 2019 at 12:16:21 AM UTC-7, Sander Elias wrote: > > Hi Scott, > > I can come up with at least 5 different ways of doing what you ask for. > That's probably even a low estimate. I need to know a bit more to give you > a way that suits your actual needs, way of working. > But I set up a simple sample for you. You can see it running here > <https://nbwixpva.github.stackblitz.io/requiredAttributes> > > export class WaitForItComponent { > @Input() set prop1(val) { val && this.setIt('prop1', val); } > @Input() set prop2(val) { val && this.setIt('prop2', val); } > @Input() set prop3(val) { val && this.setIt('prop3', val); } > > requiredProps = []; > > goodToGo$ = new Subject<any[]>(); > > setIt(propName: string, value: string) { > this.requiredProps.push({ propName, value }); > if (this.requiredProps.length === 3) { > this.goodToGo$.next(this.requiredProps); > } > } > } > > For me, this strikes a nice balance between easy to maintain and > complexity. the complete sample can be found here. > Is this what you are looking for? > > Regards > Sander > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.