Nebular: cant implement constructor of extended component from NbLoginComponent

Created on 27 Apr 2019  路  1Comment  路  Source: akveo/nebular

i extend LoginComponent from NbLoginComponent and when run code i have error

Uncaught Error: Can't resolve all parameters for LoginComponent: ([object Object], [object Object], [object Object], ?, [object Object], [object Object]).

this is my implementation what is error in constructor?

import { Component, ChangeDetectorRef } from '@angular/core';
import { NbLoginComponent, NbAuthService } from '@nebular/auth';
import { MyCustomAuthService } from '../MyCustomAuthService';
import { Router } from '@angular/router';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';

@Component({
  selector: 'ngx-login',
  templateUrl: './login.component.html',
})
export class LoginComponent extends NbLoginComponent {
  // over ride paramaters in NbLoginComponent
  redirectDelay: number = 500;
  showMessages: any;
  strategy: string;
  errors: string[];
  messages: string[];
  user: any;
  submitted: boolean;
  // socialLinks: NbAuthSocialLink[];
  rememberMe: boolean;
  form: FormGroup;

  constructor(private fb: FormBuilder, private MyCustomAuthService: MyCustomAuthService, service: NbAuthService, options: {},
    cd: ChangeDetectorRef, router: Router) {
    super(service, options, cd, router);

    this.form = this.fb.group({
      email: ['', Validators.required],
      password: ['', Validators.required]
    });

  }



  login() {
    const val = this.form.value;

    // this.MyCustomAuthService.login(val.email, val.password).subscribe(
    //   () => {

    //     console.log("User is logged in");
    //     this.router.navigateByUrl('/');
    //   }
    // );
  }
}

Most helpful comment

i find soultion here
https://github.com/akveo/nebular/issues/1234#issuecomment-463611383

my updated constructor

 constructor(private fb: FormBuilder, 
private myCustomAuthService: MyCustomAuthService, 
service: NbAuthService, 
@Inject(NB_AUTH_OPTIONS) options:{},
 cd: ChangeDetectorRef, router: Router)

>All comments

i find soultion here
https://github.com/akveo/nebular/issues/1234#issuecomment-463611383

my updated constructor

 constructor(private fb: FormBuilder, 
private myCustomAuthService: MyCustomAuthService, 
service: NbAuthService, 
@Inject(NB_AUTH_OPTIONS) options:{},
 cd: ChangeDetectorRef, router: Router)
Was this page helpful?
0 / 5 - 0 ratings