import { Component,OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-logout',
template: ''
})
export class Logouts implements OnInit{
constructor(private path:Router){
}
ngOnInit(){
localStorage.clear();
this.path.navigate(['./login']);
}
}
Hi i am using ng2-dragula for drag and drop. it is working perfectly. But when i am clicking the logout link it redirect to logout component. where i clear the local storage. then navigate to login page.but it gives error when i click on link ERROR Error: Uncaught (in promise): Error: Bag named: "bag1" already exists. here is my logout component code but i am not using any bag1 on logout component.i am using that bag1 on different component. i do not know what is the exact issue. please help me.