ngx-bootstrap解析(一)
来源:互联网 发布:淘宝认证出现bad apple 编辑:程序博客网 时间:2024/06/14 20:40
TAB
tab插件一共7个文件
ng-transclude.directive
import { Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';@Directive({ selector: '[ngTransclude]'})export class NgTranscludeDirective { public viewRef:ViewContainerRef; protected _viewRef:ViewContainerRef; protected _ngTransclude:TemplateRef<any>; @Input() public set ngTransclude(templateRef:TemplateRef<any>) { this._ngTransclude = templateRef; if (templateRef) { this.viewRef.createEmbeddedView(templateRef); } } public get ngTransclude():TemplateRef<any> { return this._ngTransclude; } public constructor(viewRef:ViewContainerRef) { this.viewRef = viewRef; }}
上述代码用到了TemplateRef和ViewContainerRef,关于这两个的具体用法,请看这篇文章
文章写得有些晦涩 不过用起来是比较简单的,我们只需要知道:
this.ViewContainerRef.createEmbeddedView(this.TemplateRef);
即:利用TemplateRef得到ag的模板文件里面的元素,然后放到ViewContainerRef容器中使用
这个指令的目的是:创建时传入一个viewcontainer容器,用的时候,可以将容器传入或取出一个templateRef对象,总的来说,就是对传入template对象的一个小封装
阅读全文
0 0
- ngx-bootstrap解析(一)
- ngx-bootstrap学习笔记(一)-popover
- ngx-bootstrap中的datepicker实现本地化,国际化
- ngx lua模块源码简单解析
- Angular开发-ngx-bootstrap的UI组件介绍
- angular2 ngx-bootstrap modal模态框不在最上层
- Bootstrap-Sass 源码解析一:文件组织架构
- Bootstrap学习(一)
- bootstrap-table(一)
- Bootstrap总结(一)
- 关于Bootstrap(一)
- 认识BootStrap(一)
- Bootstrap学习(一)
- Bootstrap(一)
- Bootstrap学习(一)
- Bootstrap(一)
- bootstrap 基础(一)
- bootstrap 基础(一)
- 教你如何迅速秒杀掉:99%的海量数据处理面试题
- EventBus打包混淆问题
- html工具合集
- [LeetCode]338. Counting Bits
- RFID无线射频识别技术
- ngx-bootstrap解析(一)
- OCX制作CAB(三) -- INF文件的编写及WEB JS 调用OCX和CAB
- Android读取服务器图片
- android studio开启无线调试模式
- android框架大全 2017百大框架排行
- 数据结构之队列
- Linux下MySQL数据库常用基本操作 一
- Train Problem I CSU-ACM2017暑期训练1-Debug与STL
- js 拼出 带有自定义属性的特定的值