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

hoodie-plugin-angularjs

v0.1.1

Published

Hoodie plugin to connect to angularJS

Downloads

17

Readme

Hoodie AngularJS Plugin

devDependency Status Build Status Coverage Status

Hoodie goes angular in a cozy way!

A lot is missing, but the good news are: you can contribute!

A little bit about the plugin.

Install

$ hoodie install angularjs in your project folder will install the plugin. You need to load angular BEFORE the hoodie-plugin.

<script src="jquery.js"></script>
<script src="hoodie.js"></script>
<script src="angular.js"></script>
<script src="hoodie-plugin-angularjs.js"></script>

Load the hoodie module into angular and initialize hoodie. Note: If you don't specify any url hoodie-angular will just fall back to the current URL.

angular.module('worldDominationApp', ['hoodie'])
  .config(function(hoodieProvider) {
    hoodieProvider.url('http://myhoodie.com/');
  });

Services

There are currently four services. hoodie, hoodieAccount, hoodieStore and hoodieArray.

hoodie

Use hoodieProvider.url(String) to configure your app's hoodie url at startup. Scroll down for an example.

You can then inject hoodie with dependency injection anywhere to get your plain old hoodie instance. For more angular-friendly services, use the below.

hoodieAccount

Use the same API like plain hoodie. Use dependency Injection.

hoodieStore

Use the same API like plain hoodie. Use dependency Injection if you want to use this. We recommend you to use hoodieArray.

hoodieArray

Add hoodieArray to your di-array. With the bind method you could bind an array to your hoodie store.

hoodieArray.bind(scope, store[, hoodieStore])

  • scope: the scope to bind with. Normaly $scope
  • store: the place were the store binds to.
  • hoodieStore: Optional. the store name in hoodie. If unset, store will be used.

Example:

angular.module('worldDominationApp', ['hoodie'])
  .config(function(hoodieProvider) {
    hoodieProvider.url('http://myhoodie.com/');
  })
  .controller('TodoCtrl', function ($scope, hoodieArray) {

    $scope.delete = function(item) {
      var idx = $scope.todos.indexOf(item);
      $scope.todos.splice(idx, 1);
    };

    $scope.add = function (title) {
      $scope.todos.push({
        title: title
      });
      $scope.newTodo = '';
    }

    hoodieArray.bind($scope, 'todos', 'todo');
  });

hoodieObject

Add hoodieObject to your di-array. With the bind method you could bind an object to your hoodie store.

hoodieObject.bind(store, id)

  • store: the place were the item is saved.
  • id: the items id you want to bind to.

Returns an object with the item you selected from hoodie.

Example:

angular.module('worldDominationApp', ['hoodie'])
  .config(function(hoodieProvider) {
    hoodieProvider.url('http://myhoodie.com/');
  })
  .controller('TodoCtrl', function ($scope, hoodieObject) {

    $scope.secretSuperpower = hoodieObject.bind('superpower', '12ffID');
    // $scope.secretSuperpower contains now an object with the hoodie object with the id 12ffID
    // it is two way bounded with hoodie
  });

Development

We use gulp to build and karma to test.

Install the development dependencies.

npm install
bower install

Run gulp test to build and test once. Run gulp to start the karma test server and run test continuously on every save.

Build & Release Process

Run gulp tag to prepare the built plugin for distribution.

Internally it does the following:

  • Concat the source files and wrap them in Hoodie.extend()
  • Move the built file from dist to the project root. (We keep the concatenated file in dist by default so it cannot be accidentally commited)
  • Commit, tag, and Push