Introduction to services and dependency injection
service is a code that are used to perform a specific task, a service can contain a value or function or combination of both.Service is injected into the application using dependency injection mechanism.
Service provides its data and methods other needs components.
How to create a service:- you can easily generate service. Open your terminal and type:
ng generate service auth
Import the Injectable Member:-At the top of your new service file, add:import { Injectable }from'@angular/core';
Include it through dependency injection:- In the constructor argument of the component class, we include it through dependency injection:
constructor(
private afAuth: AngularFireAuth,
private router: Router,
private afs: AngularFirestore
) {}
Create a Method and use another component:-So, guys, you can finally create the method and use need components.So let’s go and see the little example.
auth.service.ts
emailSignUp(email: string, password: string) {
return this.afAuth.auth.createUserWithEmailAndPassword(email, password);
}
signUp.component.ts
onSubmit(model, f) {
this.auth.emailSignUp(model.email, model.password).then(res => {
this.snackBar.open('sign up success', '', { duration: 3000 });
f.reset();
}).catch(err => {
this.snackBar.open(err, '', { duration: 3000 });
});
}
-:Thanks for the reading:-

I learn some new stuff from it too, thanks for sharing your information. 2k moulding
ReplyDeleteIf may be} just starting with on-line casino games and may be} on the lookout for methods to win at on-line roulette, start from the smallest limits and go for the 1-credit games. Most European roulette games supply the same successful chances - so there are no particular roulette games that give you more alternatives to win money than others. The odds get considerably worse if you resolve to play on an American roulette wheel. The second green slot brings them minimal of} one|to 1} in 38 on every single number wager. If may be} in the UK or in Ireland, I counsel you open a free account at 888casino to play roulette games on-line. A license issued by these authorities certifies the fairness of the true money roulette games, of the casino softwares, and of the companies that run the companies 카지노 사이트 and deal with your money.
ReplyDelete