用Angular 6切换div [英] Toggle div with Angular 6
本文介绍了用Angular 6切换div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Angular的新手,想从简单易学的东西入手.
I'm new to Angular and want to start with something simple to learn.
我目前正在开发一个表格,并具有div,我需要在选择用户时进行切换.我需要创建Angular 6组件来创建这样的切换功能吗?
I'm currently developing a form and have divs which I need to toggle upon user selection. Do I need to create Angular 6 component to create such a toggle function?
如何进行切换-是否使用组件(如果可能)?
How can I do the toggle - whether with component or without (if possible)?
谢谢
推荐答案
您可以尝试以下方法:
const isOpened = true;
<div *ngIf="isOpened">
<form> </form>
<div>
<div *ngIf="!isOpened">
<form> </form>
<div>
这篇关于用Angular 6切换div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文