angular—— Dynamic Templates】的更多相关文章

原文:http://davidcai.github.io/blog/posts/router-dynamic-templates/ ui-router : templateProvider vs template ---------------------------------------------- Router: Dynamic Templates Sat Aug 15, 2015 This post discusses how to create dynamic templates b…
1.ES Mapping 在lucene中,索引中每个字段都需要指定很多属性,例如:是否分词.采用哪个分词器.是否存储等. 在ES中,其实索引中每个字段也需要指定这些属性,我们有时候并没有对这些属性进行设置,这得益于ES的动态映射(Dynamic Mapping). 参考:Dynamic Mapping Dynamic Mapping可以解决一部分场景,但有时候ES并不能很好的理解我们的业务数据,这时就需要我们自己指定这些属性(Explicit Mapping). 例如: PUT my_inde…
Angular 2 templates have a special let syntax that allows you to define and pass a context when they’re being generated. We have template: <template #template let-description="description"> <h2>My {{description}} template</h2>…
After create a component dynamic, we are able to change the component's props and listen to its event. component: ComponentRef<AuthFormComponent>; ngAfterContentInit() { const factory = this.resolver.resolveComponentFactory(AuthFormComponent);this.c…
Let's say you want to rending some component based on condition, for example a Tabs component. Inside tabs, you want to render different tab component: <div *ngFor="let comp of comps"> <ng-container *ngComponentOutlet="comp"&g…
To create a component dynamicly. 1. Add a container with ref: @Component({ selector: 'app-root', template: ` <div> <div #entry> <!-- We want to create auth-form component inside this div--> </div> </div> ` }) 2. View this con…
Now that Angular 2 is in beta, the time has come for us to drop everything and learn something new, again. The good news is, like React and Angular 1.x, Angular 2 is here to stay for a while so it’s a good investment to become productive with this ne…
Angular 2 templates have a special let syntax that allows you to define and pass a context when they’re being generated. import {Component, ViewChild, ViewContainerRef, ComponentFactoryResolver, ViewChild} from '@angular/core'; import {SimpleService}…
Angular 2 Components have templates, but you can also create templates inside of your templates using Angular 2 ViewContainer’s createEmbeddedView for more visual control of how you want to generate elements inside of your Angular 2 templates. import…
Angular 2 templates use a special Async pipe to be able to render out Observables. This lesson covers the syntax used to create an Observable in Angular 2 and then to render it out in the template. import {Component} from 'angular2/core'; import {boo…