File

src/app/modules/groups/components/back-button/back-button.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(resourceService: ResourceService, groupService: GroupsService, layoutService: LayoutService, activatedRoute: ActivatedRoute)
Parameters :
Name Type Optional
resourceService ResourceService No
groupService GroupsService No
layoutService LayoutService No
activatedRoute ActivatedRoute No

Methods

goBack
goBack()
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

layoutConfiguration
Type : any
Public layoutService
Type : LayoutService
Public resourceService
Type : ResourceService
Public unsubscribe
Default value : new Subject<void>()
import { ResourceService, LayoutService } from '@sunbird/shared';
import { Component, OnInit } from '@angular/core';
import { GroupsService } from '../../services';
import { ActivatedRoute } from '@angular/router';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';

@Component({
  selector: 'app-back-button',
  templateUrl: './back-button.component.html',
  styleUrls: ['./back-button.component.scss']
})
export class BackButtonComponent implements OnInit {

layoutConfiguration: any;
public unsubscribe = new Subject<void>();
  constructor(public resourceService: ResourceService,
    private groupService: GroupsService, public layoutService: LayoutService, private activatedRoute: ActivatedRoute) { }

  goBack() {
    this.groupService.addTelemetry({id: 'back-button'}, this.activatedRoute.snapshot, []);
    this.groupService.goBack();
  }

  ngOnInit() {
    this.layoutConfiguration = this.layoutService.initlayoutConfig();
    this.layoutService.switchableLayout().
      pipe(takeUntil(this.unsubscribe)).subscribe(layoutConfig => {
        if (layoutConfig != null) {
          this.layoutConfiguration = layoutConfig.layout;
        }
      });
    }
}
<button type="button" (click)="goBack()" [ngClass]="layoutConfiguration ? 'sb-btn-primary sb-btn-round' : 'sb-btn-link sb-btn-link-primary sb-left-icon-btn px-0'" class="sb-btn sb-btn-normal" tabindex="0" attr.aria-label="{{resourceService?.frmelmnts?.btn?.back}}"><i
    class="icon-svg icon-svg--xxs icon-back"><svg class="icon icon-svg--primary">
      <use xlink:href="assets/images/sprite.svg#arrow-long-left"></use>
    </svg></i>
    <span class="mx-8">{{resourceService?.frmelmnts?.btn?.back}}</span> 
  </button>

./back-button.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""