| 
									
										
										
										
											2016-06-23 09:47:54 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							|  |  |  |  * Copyright Google Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Use of this source code is governed by an MIT-style license that can be | 
					
						
							|  |  |  |  * found in the LICENSE file at https://angular.io/license
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-08 16:38:52 -07:00
										 |  |  | import {ElementRef} from './element_ref'; | 
					
						
							| 
									
										
										
										
											2016-04-13 17:05:17 -07:00
										 |  |  | import {EmbeddedViewRef} from './view_ref'; | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-01 11:12:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2015-09-21 12:32:25 -07:00
										 |  |  |  * Represents an Embedded Template that can be used to instantiate Embedded Views. | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-01-09 13:16:46 -08:00
										 |  |  |  * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element | 
					
						
							|  |  |  |  * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into | 
					
						
							|  |  |  |  * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for | 
					
						
							|  |  |  |  * the `TemplateRef` from a Component or a Directive via {@link Query}. | 
					
						
							| 
									
										
										
										
											2015-09-18 15:46:26 -07:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2017-10-13 22:27:38 +03:00
										 |  |  |  * To instantiate Embedded Views based on a Template, use {@link ViewContainerRef# | 
					
						
							|  |  |  |  * createEmbeddedView}, which will create the View and attach it to the View Container. | 
					
						
							| 
									
										
										
										
											2016-05-25 15:00:05 -07:00
										 |  |  |  * @stable | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-04-28 14:00:31 -07:00
										 |  |  | export abstract class TemplateRef<C> { | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  |   /** | 
					
						
							| 
									
										
										
										
											2015-09-21 12:32:25 -07:00
										 |  |  |    * The location in the View where the Embedded View logically belongs to. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * The data-binding and injection contexts of Embedded Views created from this `TemplateRef` | 
					
						
							|  |  |  |    * inherit from the contexts of this location. | 
					
						
							|  |  |  |    * | 
					
						
							|  |  |  |    * Typically new Embedded Views are attached to the View Container of this location, but in | 
					
						
							|  |  |  |    * advanced use-cases, the View can be attached to a different container while keeping the | 
					
						
							|  |  |  |    * data-binding and injection context from the original location. | 
					
						
							| 
									
										
										
										
											2015-09-18 15:46:26 -07:00
										 |  |  |    * | 
					
						
							| 
									
										
										
										
											2015-07-17 08:03:40 -07:00
										 |  |  |    */ | 
					
						
							| 
									
										
										
										
											2015-09-21 12:32:25 -07:00
										 |  |  |   // TODO(i): rename to anchor or location
 | 
					
						
							| 
									
										
										
										
											2017-09-28 13:36:56 -07:00
										 |  |  |   abstract get elementRef(): ElementRef; | 
					
						
							| 
									
										
										
										
											2016-04-13 17:05:17 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-28 14:00:31 -07:00
										 |  |  |   abstract createEmbeddedView(context: C): EmbeddedViewRef<C>; | 
					
						
							| 
									
										
										
										
											2015-10-06 06:53:39 -07:00
										 |  |  | } |