Skip to content


Repository files navigation

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.

Docs & Demo

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.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 for the full permission list.

  photos: true,
  video: true
  // Success:
  function (response) {
    var name = response.session.user.first_name;
    alert('Hello, ' + name + '!');
  // Error:
  function (response) {
    alert('Sorry, access denied.');
// Call "users.get" API method.
// See for the full method list.'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.');

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 Comments Widget


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 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 Widget


VK Share Widget


VK Subscribe Widget

<vk-subscribe owner-id="ID"></vk-subscribe>