0.0.19 • Published 6 years ago

ngx-zalo v0.0.19

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Ngx Zalo

This module is used for Angular 5.
This module help you to use Zalo SDK as service.

Demo Ngx Zalo.

How to use:

Installation:

npm install ngx-zalo

Import 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

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago