npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vk-api-angular

v1.2.0

Published

VK Open API AngularJS wrapper

Downloads

14

Readme

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 Widget

<vk-recommended></vk-recommended>

VK Share Widget

<vk-share></vk-share>

VK Subscribe Widget

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