Issue
Angular Material's documentation says:
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
@NgModule ({
imports: [
MatSlideToggleModule,
]
})
class AppModule {}
But Angular 17 doesn't create app.module file by default. Is there any way to do that without app.module?
Solution
import dependencies into the component instead of app.modules, add attribute standalone:true , like the code below:
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
@Component({
standalone:true,
imports: [
MatSlideToggleModule,
],
selector: 'your-component',
templateUrl: './your.component.html',
styleUrls: ['./your.component.scss']
})
Answered By - salvo720
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.