Socket
Socket
Sign inDemoInstall

vk-api-angular

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vk-api-angular

VK Open API AngularJS wrapper


Version published
Weekly downloads
8
increased by700%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.2.0

  • Added base class for widgets.
  • Added provider for the configuration phase.

Readme

Source

VK API Angular

Build Status Codecov devDependencies Status

VK Open API wrapper for AngularJS.

  • Supports VK API methods via AngularJS service.
  • Supports VK widgets via AngularJS directives.
  • Replaces callbacks with promises.

VK API (service)

You may initialize your VK application using the provider during the configuration phase:

angular.module('my-app', ['vk-api-angular'])
  .config(function (VKApiProvider) {
    VKApiProvider.init(10000); // Your VK APP_ID
  });

VKApi factory duplicates the official VK Open API method naming, in particular:

  • VKApi.Api.call
  • VKApi.Auth.login
  • VKApi.Auth.logout
  • VKApi.Auth.revokeGrants
  • VKApi.Auth.getLoginStatus
  • VKApi.Auth.getSession

However, the promises are used instead of callbacks. This gives a better control over the success/error handling mechanism.

// Log in and request the "photos" and "video" permissions.
// See https://vk.com/dev/permissions for the full permission list.

VKApi.Auth.login({
  photos: true,
  video: true
}).then(
  // Success:
  function (response) {
    var name = response.session.user.first_name;
    alert('Hello, ' + name + '!');
  },
  // Error:
  function (response) {
    alert('Sorry, access denied.');
    console.error(response);
  }
);
// Call "users.get" API method.
// See https://vk.com/dev/methods for the full method list.

VKApi.Api.call('users.get').then(
  // Success:
  function (response) {
    var name = response[0].first_name;
    alert('Hello, ' + name + '!');
  },
  // Error:
  function (response) {
    alert('Sorry, could not fetch the user data.');
    console.error(response);
  }
);

VK Widgets (directives)

VK Allow Messages From Community Widget
<vk-allow-messages-from-community group-id="ID"></vk-allow-messages-from-community>
VK Auth Widget
<vk-auth></vk-auth>
VK Comments Widget
<vk-comments></vk-comments>
VK Community Widget
<vk-community group-id="ID"></vk-community>
VK Community Messages Widget
<vk-community-messages group-id="ID"></vk-community-messages>
VK Contact Us Widget
<vk-contact-us owner-id="ID"></vk-contact-us>
VK Like Widget
<vk-like></vk-like>
VK Poll Widget
<vk-poll poll-id="POLL"></vk-poll>
VK Post Widget
<vk-post owner-id="ID" post-id="POST" hash="HASH"></vk-post>
<vk-recommended></vk-recommended>
VK Share Widget
<vk-share></vk-share>
VK Subscribe Widget
<vk-subscribe owner-id="ID"></vk-subscribe>

Keywords

FAQs

Last updated on 02 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc