Skip to content

Support Angular 15 stand alone components #247

Description

@vytautas-pranskunas-

With new Angular 15 tandalone components became stable, however there is a little problem with this library when using them.
We have to importmodule when app is bootstrapping:

const providers = importProvidersFrom(
    ...
    NotifierModule.withConfig({
        position: {
            horizontal: { position: 'right' },
            vertical: { position: 'top' },
        },
        behaviour: {
            autoHide: 3000,
        },
    }),
);

bootstrapApplication(AppComponent, {
    providers: [
        providers,
       ...
    ],
}).catch((err) => console.error(err));

and we cannot import Notifier component it self to app.component.ts like this:

@Component({
    selector: 'app-root',
    standalone: true,
    imports: [CommonModule, RouterModule, NotifierNotificationComponent], <--------------- not stand alone
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent implements OnInit, OnDestroy {

instead we have to import module which resets config.
There is a little fix for that - we need to declare notifier as standalone.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BREAKING CHANGEIndicates a breaking changetype: compatibilityIndicates an issue that only occurs on specific browsers / operating systems / devices

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions