Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. // Import the core angular services.
  2. import { Component } from "@angular/core";
  3.  
  4. // Import the application components and services.
  5. import { UserConfigService } from "./user-config.service";
  6.  
  7. // ----------------------------------------------------------------------------------- //
  8. // ----------------------------------------------------------------------------------- //
  9.  
  10. @Component({
  11. selector: "app-root",
  12. styleUrls: [ "./app.component.less" ],
  13. template:
  14. `
  15. <p class="flag-controls">
  16. <strong>Set Feature Flag</strong>:
  17. <a (click)="setFeatureFlag( true )">Yes</a> ,
  18. <a (click)="setFeatureFlag( false )">No</a>
  19. &mdash;
  20. ( Current: <strong>{{ userConfigService.isUsingNewHawtness }}</strong> )
  21. </p>
  22.  
  23. <nav>
  24. <a routerLink="/app">Home</a> ,
  25. <a routerLink="/app/projects">Projects</a>
  26. </nav>
  27.  
  28. <router-outlet></router-outlet>
  29. `
  30. })
  31. export class AppComponent {
  32.  
  33. public userConfigService: UserConfigService;
  34.  
  35. // I initialize the app component.
  36. constructor( userConfigService: UserConfigService ) {
  37.  
  38. this.userConfigService = userConfigService;
  39.  
  40. }
  41.  
  42. // ---
  43. // PUBLIC METHODS.
  44. // ---
  45.  
  46. // I set the feature flag that determines which version of the Projects list is
  47. // rendered on the "projects" route.
  48. // --
  49. // NOTE: This is just for the demo. Normally, a feature flag would be configured by
  50. // the Product Team based on targeting rules.
  51. public setFeatureFlag( value: boolean ) : void {
  52.  
  53. this.userConfigService.isUsingNewHawtness = value;
  54.  
  55. }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement