随笔分类 -  AngularJs

摘要:1.在 xx.html 中直接 写标签 <a [routerLink]="['/home']">home</a> 2.在 xx.html 中 触发click事件 <button class="btn btn-primary" (click)="Login()">Submit</button> 在xx 阅读全文
posted @ 2017-12-13 15:42 tony_zhu 阅读(2354) 评论(0) 推荐(0)
摘要:1.在xx.ts中引入css样式无效 @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) 解决:去除 styleUrls中的 ./ 阅读全文
posted @ 2017-12-13 10:53 tony_zhu 阅读(655) 评论(0) 推荐(0)
摘要:1.cnpm install ngx-bootstrap bootstrap --save ※可能缺少jquery cnpm i jquery 2. 打开 angular-cli.json (项目根目录下) style 节点 增加 "styles": [ "../node_modules/boots 阅读全文
posted @ 2017-12-13 10:46 tony_zhu 阅读(1206) 评论(0) 推荐(0)
摘要:目的:为了不再把相同的代码复制一遍又一遍,我们要创建一个单一的可复用的数据服务,并且把它注入到需要它的那些组件中。 ※ 文件命名约定:服务名称的小写形式(基本名),加上.service后缀,如果服务名称包含多个单词,我们就把基本名部分写成中线形式 (dash-case)。 1.新建服务 xx.ser 阅读全文
posted @ 2017-12-07 14:57 tony_zhu 阅读(142) 评论(0) 推荐(0)
摘要:angular/cli 安装 ♦ npm uninstall -g angular-cli /cnpm install -g angular-cli ※采用npm安装失败: Missing write access to XXXXXX.. ♦ 安装成功后 cd 项目目录 ♦ cnpm i 安装依赖 阅读全文
posted @ 2017-12-06 15:06 tony_zhu 阅读(146) 评论(0) 推荐(0)