DialogService in a Module Less app

3 Answers 114 Views
Dialog
Pablo
Top achievements
Rank 2
Iron
Pablo asked on 13 Jan 2023, 09:31 PM

Hi, I'm facing with a problem when trying to use DialogService in a module less application with Angular 15

I've created a sample application to ilustrate the problem. Is based on the official documentation located at:

https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/#toc-content-template

When I launch the app the button doesn't appear and a console error is thrown about BrowserModule

Here is a screenshot with that error.

Thanks in advance!

 

3 Answers, 1 is accepted

Sort by
0
Pablo
Top achievements
Rank 2
Iron
answered on 13 Jan 2023, 10:21 PM

Hi again, 

Forget it, I figure out how to do it

I must import that modules at main.ts this way:

import {bootstrapApplication, BrowserModule} from "@angular/platform-browser";
import {AppComponent} from "./app/app.component";
import {importProvidersFrom} from "@angular/core";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {DialogModule} from "@progress/kendo-angular-dialog";

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

then, in app.component.ts i need to import CommonModule and DialogsModule

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  standalone : true, imports: [CommonModule, DialogsModule]
})

How can I publish for other customers can see the solution in case they encounter the same problem?

I think module less will be adopted by many people and i found much less documentation about it (not only to kendo related things) on how to do the same things without NgModule

Thanks!!

0
Martin
Telerik team
answered on 16 Jan 2023, 11:27 AM

Hi Pablo,

Thank you for the provided details.

I am glad to hear that you've managed to fix the experienced issue.

One thing that I want to add here is that the DialogsModule (or DialogModule) could be imported only in the component where the Dialog is defined. No need to import it in the main.ts.

This thread is private and the information here isn't shared with the community. I can change the type of the ticket after your permission to a public forum thread. Then everyone can see the information here. Do you want me to transfer the ticket to our Forum?

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Pablo
Top achievements
Rank 2
Iron
answered on 16 Jan 2023, 01:33 PM

Hi Martin, thank you very much, yes if you consider the content interesting to other you can transfer it

Regards!

Tags
Dialog
Asked by
Pablo
Top achievements
Rank 2
Iron
Answers by
Pablo
Top achievements
Rank 2
Iron
Martin
Telerik team
Share this question
or