Angular 如何在“角度材质”对话框中创建自定义动画?
我正在使用“角度材质”对话框组件代码,并希望在打开/关闭持续时间内添加幻灯片右侧动画Angular 如何在“角度材质”对话框中创建自定义动画?,angular,angular-material,angular9,Angular,Angular Material,Angular9,我正在使用“角度材质”对话框组件代码,并希望在打开/关闭持续时间内添加幻灯片右侧动画 openDialog() { this.dialog.open(DialogContentExampleDialog); } 谢谢您可以使用名为ng dialog animation的库,并使用此名为NgDialogAnimationService的服务打开对话框而不是MatDialog 您的组件将具有以下代码行: import { Component } from "@angular/co
openDialog() {
this.dialog.open(DialogContentExampleDialog);
}
谢谢您可以使用名为ng dialog animation的库,并使用此名为NgDialogAnimationService的服务打开对话框而不是MatDialog 您的组件将具有以下代码行:
import { Component } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import { NgDialogAnimationService } from "ng-dialog-animation";
@Component({
selector: "dialog-content-example",
templateUrl: "dialog-content-example.html",
styleUrls: ["dialog-content-example.css"],
})
export class DialogContentExample {
constructor(public dialog: NgDialogAnimationService){}
openDialog() {
const dialogRef = this.dialog.open(DialogContentExampleDialog, {
width: "250px",
// option1
animation:{to:"aside"},})
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
}
您可以使用名为ng dialog animation的库,并使用此名为NgDialogAnimationService的服务打开对话框而不是MatDialog 您的组件将具有以下代码行:
import { Component } from "@angular/core";
import { MatDialog } from "@angular/material/dialog";
import { NgDialogAnimationService } from "ng-dialog-animation";
@Component({
selector: "dialog-content-example",
templateUrl: "dialog-content-example.html",
styleUrls: ["dialog-content-example.css"],
})
export class DialogContentExample {
constructor(public dialog: NgDialogAnimationService){}
openDialog() {
const dialogRef = this.dialog.open(DialogContentExampleDialog, {
width: "250px",
// option1
animation:{to:"aside"},})
dialogRef.afterClosed().subscribe(result => {
console.log(`Dialog result: ${result}`);
});
}
}
把这个放在index.hml中
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css" />
把这个放在index.hml中
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.0.0/animate.min.css" />
为此,请检查animated.css。您可以添加remove类名,以便轻松地检查animated.css的css效果。你可以添加移除类名来轻松实现css效果,Tanks@Mina Shah我试过了,但不起作用是的,很好:谢谢@Mina Shah我试过了,但不起作用是的,很好: