摘要: 1,结构型指令 ①影响html结构的指令 ②*ngFor *ngIf *ngSwitchCase *ngSwitchDefault 2,属性型指令 ①会改变某个元素、组件或其他指令的外观或行为 ②比如,内置的NgStyle指令可以同时修改元素的多个样式 3,常用的属性型指令 ①事件绑定 步骤一:在对 阅读全文
posted @ 2020-01-16 19:49 shanlu 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 练习1:多重判断 ①创建一个组件demo05,在这个组件中,有一个变量uName,如果用户名是lucy显示“你好,Lucy”,如果是Tom,显示“你好,Tom”,否则其他情况时,显示“请去登陆” ②初始化一个对象数组stuList(包含5个元素),每个对象都包含 name/age/sex/score 阅读全文
posted @ 2020-01-16 19:24 shanlu 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 多重判断 *ngSwitchCase *ngSwitchDefault,有一个使用前提:通过[ngSwitch]去指定判断条件 demo04.component.ts demo04.component.html 阅读全文
posted @ 2020-01-16 17:35 shanlu 阅读(255) 评论(0) 推荐(0) 编辑
摘要: ①添加插件 在demo.component.ts中按下a-c 再回车,自动创建组件格式 ②创建Demo04Component来渲染Angular选择指令 选择指令: <any *ngIf="表达式"></any> demoo4.component.ts demo04.component.html ③ 阅读全文
posted @ 2020-01-16 17:19 shanlu 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 1,模板页面的html上需要声明Thymeleaf的命名空间,<html xmlns:th="http://www.thymeleaf.org"> 2,文本标签 th:text/th:utext th:text进行文本替换,不会解析html <p th:text="text标签: + ${msg}" 阅读全文
posted @ 2020-01-16 13:19 shanlu 阅读(166) 评论(0) 推荐(0) 编辑