Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View provider/provider info that's logged in the console is incorrect #55570

Open
1 of 2 tasks
HymanZHAN opened this issue Apr 28, 2024 · 0 comments
Open
1 of 2 tasks
Labels
area: core Issues related to the framework runtime core: di
Milestone

Comments

@HymanZHAN
Copy link

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

  • Create a component with both providers and viewProviders
  • Inspect the DI information in the "Injector Tree" tab in Angular DevTools
  • Log different providers to the console
  • The value entry is incorrect

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

Should log different providers accurately.

Please provide a screenshot if possible [Bug Report only]

BComponent:

@Component({
  selector: 'app-b',
  standalone: true,
  imports: [CComponent],
  providers: [
    {
      provide: Flower,
      useValue: new Flower('🌺'),
    },
  ],
  viewProviders: [
    {
      provide: Flower,
      useValue: new Flower('🌻'),
    },
  ],
  template: `
    B (<code>&#64;SkipSelf</code>): {{ flower.name }}
    <br />
    <app-c [prefix]="prefix" />
    <ng-content></ng-content>
  `,
})
export class BComponent {
  // ...
}

Screenshot 2024-04-28 121505
Screenshot 2024-04-28 121546

Notice how the second log has a discrepancy between provider.useValue and value:

Please provide the exception or error you saw [Bug Report only]

No response

Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]

No, I can reproduce it on both Firefox and Chrome.

Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

@HymanZHAN HymanZHAN changed the title View provider info that's logged in the console is incorrect View provider/provider info that's logged in the console is incorrect Apr 28, 2024
@thePunderWoman thePunderWoman added the area: core Issues related to the framework runtime label Apr 30, 2024
@ngbot ngbot bot added this to the needsTriage milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime core: di
Projects
None yet
Development

No branches or pull requests

2 participants