| 
									
										
										
										
											2016-09-09 16:54:26 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @license | 
					
						
							| 
									
										
										
										
											2020-05-19 12:08:49 -07:00
										 |  |  |  * Copyright Google LLC All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2016-09-09 16:54:26 -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
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // #docregion LocationComponent
 | 
					
						
							|  |  |  | import {HashLocationStrategy, Location, LocationStrategy} from '@angular/common'; | 
					
						
							|  |  |  | import {Component} from '@angular/core'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @Component({ | 
					
						
							|  |  |  |   selector: 'hash-location', | 
					
						
							|  |  |  |   providers: [Location, {provide: LocationStrategy, useClass: HashLocationStrategy}], | 
					
						
							|  |  |  |   template: `
 | 
					
						
							|  |  |  |     <h1>HashLocationStrategy</h1> | 
					
						
							|  |  |  |     Current URL is: <code>{{location.path()}}</code><br> | 
					
						
							|  |  |  |     Normalize: <code>/foo/bar/</code> is: <code>{{location.normalize('foo/bar')}}</code><br> | 
					
						
							|  |  |  |   `
 | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | export class HashLocationComponent { | 
					
						
							|  |  |  |   location: Location; | 
					
						
							| 
									
										
										
										
											2020-04-13 16:40:21 -07:00
										 |  |  |   constructor(location: Location) { | 
					
						
							|  |  |  |     this.location = location; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-09-09 16:54:26 -07:00
										 |  |  | } | 
					
						
							|  |  |  | // #enddocregion
 |