| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 16:54:46 -08:00
										 |  |  | import {ANALYZE_FOR_ENTRY_COMPONENTS, Component, ComponentFactoryResolver, Inject, InjectionToken} from '@angular/core'; | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | import {BasicComp} from './basic'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-14 18:06:25 +02:00
										 |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'cmp-entryComponents', | 
					
						
							|  |  |  |   template: '<p i18n>Welcome</p>', | 
					
						
							|  |  |  |   entryComponents: [BasicComp] | 
					
						
							|  |  |  | }) | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  | export class CompWithEntryComponents { | 
					
						
							|  |  |  |   constructor(public cfr: ComponentFactoryResolver) {} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-03 16:54:46 -08:00
										 |  |  | export const SOME_TOKEN = new InjectionToken('someToken'); | 
					
						
							| 
									
										
										
										
											2016-07-25 00:36:30 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | export function provideValueWithEntryComponents(value: any) { | 
					
						
							|  |  |  |   return [ | 
					
						
							|  |  |  |     {provide: SOME_TOKEN, useValue: value}, | 
					
						
							|  |  |  |     {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: value, multi: true}, | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'comp-entryComponents-provider', | 
					
						
							|  |  |  |   template: '', | 
					
						
							|  |  |  |   providers: [provideValueWithEntryComponents([{a: 'b', component: BasicComp}])] | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class CompWithAnalyzeEntryComponentsProvider { | 
					
						
							|  |  |  |   constructor(public cfr: ComponentFactoryResolver, @Inject(SOME_TOKEN) public providedValue: any) { | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } |