Components: ng1 upgraded component on dialog not working

Created on 8 Jul 2018  路  2Comments  路  Source: angular/components

Bug, feature request, or proposal:

bug

What is the expected behavior?

ng1 upgraded component works on material dialog

What is the current behavior?

Error: StaticInjectorError(AppModule)[$scope]:
StaticInjectorError(Platform: core)[$scope]:
NullInjectorError: No provider for $scope!

What are the steps to reproduce?

https://stackblitz.com/github/AminRahimi/ngUpgrade

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

:heart:

Most helpful comment

This is because you didn't provide a viewContainerRef and therefore an injector that includes the upgraded component isn't being used.

constructor(public dialog: MatDialog, private viewContainerRef: ViewContainerRef) { }

onOpenModalClick() {
  ....,
  viewContainerRef: this.viewContainerRef,
});

All 2 comments

This is because you didn't provide a viewContainerRef and therefore an injector that includes the upgraded component isn't being used.

constructor(public dialog: MatDialog, private viewContainerRef: ViewContainerRef) { }

onOpenModalClick() {
  ....,
  viewContainerRef: this.viewContainerRef,
});

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitaly-t picture vitaly-t  路  3Comments

shlomiassaf picture shlomiassaf  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

RoxKilly picture RoxKilly  路  3Comments

crutchcorn picture crutchcorn  路  3Comments