I am trying to understand Angular's DI framework and referring to the official docs in https://angular.io/guide/hierarchical-dependency-injection; particularly the difference between viewProviders and providers attributes.
While I can't say that the content is easy to follow (especially the section where it explains how it works under the hood using the combined logical tree and using the notations @Provide and @Inject sometimes in <#VIEW> and sometimes in the selector tag of the component), I concluded that using viewProviders instead of providers can affect the rendering of a projected content using <ng-content>
Coming to the question, I don't see an explanation to a scenario if the same DI token is used both in providers and viewProviders.
Eg.
Referring to the snippet from parent.component.ts, my question is : If by virtue of un-commenting the providers attribute enables rendering the value "world" as configured in the element injector, instead of the value "hello" in module injector, why is it disregarding the value "angular"?
viewProviders: [{ provide: Service, useValue: { value: 'world' } }],
// providers: [{ provide: Service , useValue: { value: 'angular' } }], // If I uncomment this line the "hello" changes to "world" and the value "angular" is disregarded
in https://stackblitz.com/edit/angular-syh4mx
It's probably not a valid use case but I'm interested to understand why it behaves the way it does.