0.0.19 • Published 8 years ago
ngx-zalo v0.0.19
Ngx Zalo
This module is used for Angular 5.
This module help you to use Zalo SDK as service.
How to use:
Installation:
npm install ngx-zaloImport service:
Edit in src/app/app.module.ts:
//...
import { NgxZaloModule, NgxZaloService } from 'ngx-zalo';
const zaloConfigs = {
version: '2.0',
appId: '<appId>',
redirectUrl: '<redirectUrl>',
};
@NgModule({
//...
imports: [
//...
NgxZaloModule,
],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(ngxZaloService: NgxZaloService) {
ngxZaloService.init(zaloConfigs);
}
}And call in component:
constructor(private _ngxZaloService: NgxZaloService) {
}Login
<!-- Using directive -->
<p ngxLoginZalo>Login Zalo</p>//Using controller
login() {
this._ngxZaloService.login();
}Logout
<!-- Using directive -->
<p ngxLogoutZalo (successEvent)="logoutSuccessfullyAction()">Logout Zalo</p>//Using controller
logout() {
this._ngxZaloService.logout().subscribe();
}Update login info - Call this function in redirect page to store zalo info
constructor(private _router: Router, private _ngxZaloService: NgxZaloService) {
this._ngxZaloService.updateLoginInfo().subscribe(() => {
this._router.navigate(['/']);
});
}Check login status
checkLoginStatus() {
console.log('Login status:', this._ngxZaloService.isLogin);
}Get my profile
getMyProfile() {
this._ngxZaloService.getMyProfile().subscribe(result => {
console.log('My profile:', result);
});
}Get access token
getAccessToken() {
console.log(this._ngxZaloService.accessToken);
}0.0.19
8 years ago
0.0.18
8 years ago
0.0.17
8 years ago
0.0.16
8 years ago
0.0.15
8 years ago
0.0.14
8 years ago
0.0.13
8 years ago
0.0.12
8 years ago
0.0.11
8 years ago
0.0.10
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago
0.0.0
8 years ago