Reputation: 1755
What does it mean?
I have import:
import {Credentials} from '../_models/credentials/credentials.model';
And constructor:
constructor(private router: Router,
private credential: Credentials){
}
Upvotes: 0
Views: 204
Reputation: 34673
You cannot inject a model in the constructor. Define credential
as a class variable.
import {Credentials} from '../_models/credentials/credentials.model';
// ...
//
private credential: Credentials;
// ... ...
//
constructor(private router: Router){ }
Upvotes: 1
Reputation: 29614
You cant inject a model class in the constructor. It needs to be @Injectable()
and set as a provider to be used by Angular's DI.
Change your constructor to:
constructor(private router: Router)
Upvotes: 2