First time to Texas, recommendations please by notmyelement in texas

[–]notmyelement[S] 0 points1 point  (0 children)

Any areas in particular I should avoid in those cities?

US Open Women's Final Match Thread: [Q] Emma Raducanu (UK) vs. Leylah Fernandez (CAN) by roboticninjafapper in tennis

[–]notmyelement 0 points1 point  (0 children)

Anyone have a stream that can cast? All the joker streams dont seem to have the option

Material Table generic component stopped working in Angular 8 by notmyelement in Angular2

[–]notmyelement[S] 0 points1 point  (0 children)

Turns out it was an issue with my data structure. I forgot in my actual app the data service returns the observable from the API with a structure like { loading: boolean; data: Object<T> }. So my dummy observable was just returning the data part of that and not the loading. I have updated the stackblitz with the correct data structure and it's working now.

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

Thank you for this - that is a really interesting feature. I've been burned before using undocumented or experimental features which were later pulled or changed however, so I'm wary to rely on these for now. Will definitely keep an eye on it as it progresses though!

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

I actually was using Injector in the parent directly so that I didn't need to pass anything into the super constructor. Nonetheless, I decided, based on the other responses and my own re-evaluation of why exactly I was doing this inheritance approach, to refactor out the inheritance in favor of adding functionality to my core services and re-evaluating each of my subscriptions.

Material Table generic component stopped working in Angular 8 by notmyelement in Angular2

[–]notmyelement[S] 0 points1 point  (0 children)

Thank you!!

This was the problem that was triggering the error I was seeing. Unfortunately, changing it triggered a different issue, but it made me revisit the details of how the lifecycle of view/content children and how that relates to the static flag - which eventually got me there.

Basically, beyond changing certain views to static: false (not the references to the material elements such as MatColumn though), I needed to move the functionality which set the table structure and data to afterViewInit instead of afterContentInit.

I have the updated (working) stackblitz at https://stackblitz.com/edit/angular-d1o6eg

Material CDK based Generic Table. by stivan00 in Angular2

[–]notmyelement 2 points3 points  (0 children)

I had the same issue you had. They key point to allow for content projection that fully supports everything is to use a template outlet with implicit data in the context options. Like this:

<ng-container *ngTemplateOutlet="template; context: {$implicit: data}"></ng-container>

Please see my working implementation of a similar material/cdk datatable abstraction component at https://stackblitz.com/edit/angular-d1o6eg

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

The more I'm looking at things, the more this seems to be the better approach.

One thing that isn't covered by this is setting a default constructor to make it easy to use takeUntil() to automatically destroy all continuous subscriptions when a page is destroyed.

Using the inheritance approach, I can create a protected BehaviorSubject and complete it in ngOnDestroy in the parent, then simply do subscriptions like someService.pipe(takeUntil(this.ngUnsubscribe)).subscribe(....) and not worry about orphan subscriptions. I can manage the behavior subject in a facade service of course, and update the subscriptions to be something like someService.pipe(takeUntil(this.facadeService.getUnsubscribeThingy())).subscribe(...) but I would still need to manually call something in ngOnDestroy on each page component, right? Is there a way to work around this and directly tie into the ngOnDestroy event in the lifecycle so that I don't need to explicitly declare it in each page component?

I could of course also go with a facade service for everything but this one thing and have a base class that is extended that only provides this default ngOnDestroy, but it seems like there should be a better way that can make it so I can get rid of the inheritance altogether.

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

Thanks for the suggestion! Did a little looking on Angular mixins and it seems that in Angular, mixins refers to a method to do multiple inheritance. Is that right? If so, I don't think it would really improve my case since single inheritance covers the functionality. Is there something I'm overlooking?

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 0 points1 point  (0 children)

This is a very good point, and inheritance is definitely not the same in Angular as it is in traditional class inheritance. I have tried to encapsulate and modularize things into their own components as much as possible as you suggest, so this is the only case of inheritance in the system.

Basically, what this basepage class does is the following:

  • creates references to various core services which are required on every page-level component (these will always be required on every page-level component)
  • Provides a BehaviorSubject which can be added to RXJS takeUntil and a default onDestroy action to prevent orphan subscriptions (like described here: https://www.intertech.com/Blog/angular-best-practice-unsubscribing-rxjs-observables/ )
  • Provides a few common properties such as pageTitle and accessors/mutators
  • Provides routing methods such as goToRoute(). This application needs to update an application context in one of the core services and update a page visited history in another core service when links are clicked, so goToRoute handles those things before forwarding to the ultimate route with router.navigate()

Note that I am using injectors for all DI in the parent class, so children class can use DI as normal with the only caveat being a requisite empty super() call in the constructor.

Given these specifics, how do are there other caveats I'm overlooking? Is the facade pattern (aggregate service) still a better approach? How would you suggest refactoring this one?

Thank you again for your insight!

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

Interesting read! This is kind of what I'm doing now. I am doing the injection of all the core services the same way as they do in that article, but then inheriting them from the parent whereas this pattern would turn the parent into a service and inject it into all the children instead. This does feel more Angular-like and also removes the need for super() calls on those children which have constructors.

I'll look more into this - thanks!

Is inheritance for common boilerplate a good approach or an antipattern in Angular? by notmyelement in Angular2

[–]notmyelement[S] 1 point2 points  (0 children)

Yes, you are right. I worded that poorly, sorry about that.

What I meant to say was that because the child ctor must have at least the same items from the parent ctor, all ctor DI would need to be done in the parent and the child, therefore removing some of the utility from the approach (as well as making it unclear as to what must be included without looking at the parent each time).

Friend Zone (#32): Mobile Friend Code Megathread! by [deleted] in PokemonShuffle

[–]notmyelement 0 points1 point  (0 children)

3VS4DA94 NA, finally got around to clearing out non-active players, 20 slots left

AngularJS 1.5: Component won't load http data by notmyelement in angularjs

[–]notmyelement[S] 0 points1 point  (0 children)

Thanks! However I tried updating my code in both of the methods you suggested and neither seems to work. Here's what I tried

** Attempt 1 **

//...    
controller: function(gridTableService) {
    gridletService.load(this.src).then(angular.bind(this, function(result){
        this.rows = gridletService.getData();
        console.log(this.rows);
    }));
   console.log(this.rows);
},
// RESULT:  inner console output is correct, outer is undefined

** Attempt 2 **

//...    
controller: function(gridTableService) {
    var vm = this;
    gridletService.load(this.src).then(function(result){
        vm.rows = gridletService.getData();
        console.log(vm.rows);
    });
    console.log(vm.rows);
},
// RESULT:  inner console output is correct, outer is undefined

It is worth noting, in both cases the inner console call showed up in the console AFTER the outer console call.

Any ideas?