[Angular 2] Share Template Content In Another Template With Content Projection <ng-content>
Angular 1 provided a mechanism to place content from your template inside of another template called transclusion. This concept has been brought into Angular 2 and was renamed to content projection and given super powers.
In this lesson learn how to setup content projection and upgrade it to support multiple projections with encapsulated functionality.
ng-content, just like Angular1 transclude, in ng-content, you can add 'select' attr to do content projection:
<ng-content select=".header"></ng-content>
<div class="result-list">
<md-list >
<md-list-item *ngFor="let item of searchResult">
{{item}}
</md-list-item>
<md-list-item *ngIf="searchResult?.length === 0">No result...</md-list-item>
<md-list-item *ngIf="!searchResult">List here...</md-list-item>
</md-list>
</div>
<ng-content select="footer"></ng-content>
Using:
<result-list [keys]="items" [urls]="urls" class="list">
<div class="header">Search result: </div>
<footer>End...</footer>
</result-list>
[Angular 2] Share Template Content In Another Template With Content Projection <ng-content>的更多相关文章
- Deferred content load was not performed. To provide the content, subscribe to the View's QueryControl event
		
{"Deferred content load was not performed. To provide the content, subscribe to the View's Quer ...
 - content is not supported outside 'script" or asp content' region
		
https://stackoverflow.com/questions/48915080/asp-net-content-is-not-supported-outside-the-script-or- ...
 - ES6, Angular,React和ABAP中的String Template(字符串模板)
		
String Template(字符串模板)在很多编程语言和框架中都支持,是一个很有用的特性.本文将Jerry工作中使用到的String Template的特性做一个总结. ES6 阮一峰老师有一个专 ...
 - [Angular 2] Exposing component properties to the template
		
Showing you how you can expose properties on your Controller to access them using #refs inside of yo ...
 - Azure ARM (5) ARM Template初探 - 本地JSON Template文件(1)
		
<Windows Azure Platform 系列文章目录> Azure ARM (1) 概览 Azure ARM (2) 概览 Azure ARM (3) ...
 - [Angular 2] Share a Service Across Angular 2 Components and Modules
		
Services are used to share data between components. They follow a module pattern that allows you to ...
 - <转载>模板声明中template <typename T>和template <class T>
		
原文地址http://blog.csdn.net/bug07250432/article/details/10150625 在c++Template中很多地方都用到了typename与class这两个 ...
 - 模板专业化和模板偏特样片(template specialization and partial template specialization)
		
测试环境: win7 64 g++ 4.8.1 /*************************************************************************** ...
 - Django——如何使用Template以及如何向template传递变量
		
如何使用模板系统 在Python代码中使用Django模板的最基本方式如下: 可以用原始的模板代码字符串创建一个 Template 对象, Django同样支持用指定模板文件路径的方式来创建 Temp ...
 
随机推荐
- HTTP -- 请求/响应 结构
			
一:一个HTTP请求报文由四个部分组成:请求行.请求头部.空行.请求数据. 1.请求行 1.请求方法:GET POST 2.URL字段 3.HTTP版本字段 2.请求头 1.Accept:浏览器可接受 ...
 - 关于jquery的事件命名空间
			
在多人协作的前端开发中,或许会遇到一个问题:几个开发人员都给一个元素添加了同样的事件,但是又有开发人员想要解除掉元素身上的某个事件效果,这时候操作起来就有些麻烦,需要用到jquery给我们提供的事件命 ...
 - FFT之大数乘法
			
#include <iostream> #include <stdio.h> #include <cmath> #include <algorithm> ...
 - Elasticsearch之shield(权限)插件安装之后的浏览详解
			
前期博客 Elasticsearch-2.4.3的3节点安装(多种方式图文详解)(含 head.kopf.marvel.shield和watcher插件安装和使用) 访问es:-u es_admin ...
 - web api 特点
			
webapi有很多特点(我不想用优点这个词),比如说restful,支持路由,简单,类似mvc controller/action的代码编写方式,灵活的托管方式,和web的集成等等. Web API的 ...
 - split---将文件分割成多个小文件
			
split命令可以将一个大文件分割成很多个小文件,有时需要将文件分割成更小的片段,比如为提高可读性,生成日志等. 选项 -b:值为每一输出档案的大小,单位为 byte. -C:每一输出档中,单行的最大 ...
 - excel的隔行插入
			
https://wenda.so.com/q/1523455238213064 #公式 IF(ISODD(ROW()),OFFSET($B$1,INT((ROW(A1)-1)/2),),OFFSET( ...
 - BZOJ 1696 [Usaco2007 Feb]Building A New Barn新牛舍 数学
			
题意:链接 方法:数学+模拟 解析: 首先这类问题不是第一次见了,所以直接知道拿x的中位数.y的中位数. 这题就是讨论情况很的烦. 题中有个限制,给出待求和的点不能选取. 所以假设奇数个点,求出x中位 ...
 - 21. Node.Js Buffer类(缓冲区)-(一)
			
转自:https://blog.csdn.net/u011127019/article/details/52512242
 - JavaScript--数据结构与算法之排序
			
排序总结————常见的排序 常见的9中排序(冒泡,选择,插入(二分插入,希尔),归并,快速,堆,计数,基数,桶排序)可分为两类 比较排序:冒泡,选择,插入(二分插入,希尔),归并,堆,快速 非比较排序 ...