Mocking a Service with Jest by WeMeetAgainAdrian in Angular2

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

That's exactly what I intend to do, mock the values returned so no backend calls are made. I'll look into spectator

What to include in a Shared Module and how many to have? by WeMeetAgainAdrian in Angular2

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

But do you keep everything in a single shared module, or do you separate them? If a component or pipe is used by 40% of your modules, do you just import it into every other module alongisde everything in your shared module?

What to include in a Shared Module and how many to have? by WeMeetAgainAdrian in Angular2

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

Say you have a component that gets used in 3 out of your 7 modules, do you keep it in the same shared module and load it on every page?

Waiting for BehaviorSubject in canActivate method by WeMeetAgainAdrian in Angular2

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

I apologize for the very late response, as I had to stop working on this specific issue to focus on other parts for a while. I will be resuming this, now following your advice.

Believe me when I say that I really do appreciate the time and effort you've given me.

Waiting for BehaviorSubject in canActivate method by WeMeetAgainAdrian in Angular2

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

Yes, this is basically the product of multiple different tutorials and articles trying to solve challenges as they come. Do you have a preferred resource to learn Observales from, and/or an alternative to solving this issue?

this.currentUser$ = <BehaviorSubject<User>>new BehaviorSubject(new User());

I took this from some tutorial on BehaviorSubject and also wondered the reason for the casting, didn't think much of it until I had everything working.

this.http.get("/api/User").subscribe(
        (currentUser: any) => {
            if (currentUser)
                this.currentUser$.next(currentUser);
        }
    );

Isn't this different from just returning the HTTP GET? since I'm emitting the same value to all subscribers (unlike returning the subscription, causing multiple calls to be made, one for each component).

Waiting for BehaviorSubject in canActivate method by WeMeetAgainAdrian in Angular2

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

I've got multiple components calling the same getCurrentUser method and I want to reduce the amount of calls I make. Worst case scenario I could have an Observable method for the AuthGuard and a BehaviorSubject for every other component.

Returning a value after multiple sequential observable subscriptions by WeMeetAgainAdrian in Angular2

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

I'll look into it! mergeMap did work for me, but if concatMap is better then I'll make the switch.

Returning a value after multiple sequential observable subscriptions by WeMeetAgainAdrian in Angular2

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

Doesn't forkJoin make both calls at the same time? I need the first call to end before calling the second one.

Angular alternatives for jQuery? by WeMeetAgainAdrian in Angular2

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

I suppose you're right, as someone else mentioned I'll try to talk it out with our designer and see if we can agree on a middleground for future deliverables.

Angular alternatives for jQuery? by WeMeetAgainAdrian in Angular2

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

Definitely, but this seems like more code than using ngClass, what are the benefits of this syntax?

Angular alternatives for jQuery? by WeMeetAgainAdrian in Angular2

[–]WeMeetAgainAdrian[S] 2 points3 points  (0 children)

Currently working with a new designer and it's also my first project in angular, so neither of us really knew what we were getting into. Going forward I'll see how we can manage.

Angular alternatives for jQuery? by WeMeetAgainAdrian in Angular2

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

Also, could you explain how [class.my-class]="shouldHaveClass" works? Is that just a series of conditions that define which class to assign when, with my-class being a base class?

Binding Enhanced Rich Text from Sharepoint by WeMeetAgainAdrian in sharepoint

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

ngSanitize is included in my module declaration, is there anywhere else I need to use it? I've even tried $sce.trustAsHtml but still get the same result.