例如:
例如:
...
例如:如果你在Angular v6或更高的版本中使用Bootstrap v4,则需要在angular.json文件中将相应的样式和脚本文件加入到"styles"和"scripts"中。
{
"projects": {
"your-project-name": {
"architect": {
"build": {
"options": {
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js"
],
...
},
...
}
}
}
}
}
例如:
import { MatDialog } from '@angular/material/dialog';
import { MyDialogComponent } from './my-dialog/my-dialog.component';
export class MyComponent {
constructor(public dialog: MatDialog) {}
openDialog() {
const dialogRef = this.dialog.open(MyDialogComponent);
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
}
下一篇:按固定步长移动元素