Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. TypeError: Cannot read property 'classList' of null
  2.  
  3. import { Component, ViewEncapsulation, OnInit } from '@angular/core';
  4.  
  5. @Component({
  6. encapsulation: ViewEncapsulation.Native,
  7. selector: 'app-root',
  8. templateUrl: './app.component.html',
  9. styleUrls: ['./app.component.scss']
  10. })
  11. export class AppComponent implements OnInit {
  12. title = 'scssTesting';
  13.  
  14. constructor() { }
  15.  
  16. step: string = 'step1';
  17.  
  18. step1: any;
  19. step2: any;
  20. step3: any;
  21.  
  22.  
  23. ngOnInit() {
  24.  
  25. }
  26.  
  27. next() {
  28.  
  29. this.step1 = document.getElementById('step1');
  30. this.step2 = document.getElementById('step2');
  31. this.step3 = document.getElementById('step3');
  32.  
  33.  
  34. if (this.step === 'step1') {
  35. this.step = 'step2';
  36. this.step1.classList.remove("is-active");
  37. this.step1.classList.add("is-complete");
  38. this.step2.classList.add("is-active");
  39.  
  40. } else if (this.step === 'step2') {
  41. ....
  42. }
  43. }
  44.  
  45. .progress {
  46. position: relative;
  47. display: flex;
  48. .........
  49. }
  50.  
  51. <div class="container">
  52. <div class="progress">
  53. <div class="progress-track"></div>
  54. <div id="step1" class="progress-step">
  55. Step One
  56. </div>
  57. <div id="step2" class="progress-step">
  58. Step Two
  59. </div>
  60. <div id="step3" class="progress-step">
  61. Step Three
  62. </div>
  63. </div>
  64. <button (click)="next()">Next Step</button>
  65. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement