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

angular-scaffold

v0.3.2

Published

Angular Scaffold is a collection of convenience wrappers around angular-model collections.

Downloads

2

Readme

Travis Status for radify/angular-scaffold Coverage Status Dependency Status devDependency Status Code Climate

Angular Scaffold

Simple scaffolding for AngularJS

Angular Scaffold is a collection of convenience wrappers around angular-model collections.

Dependencies

Running unit tests

Install the test runner with npm:

npm install

You can then run the tests with Gulp:

gulp

You can run coverage with:

gulp coverage

angular-scaffold API docs

See /docs/api.md in this project for detailed documentation of all angular-scaffold's functions.

Supporting angular-scaffold in your API

Your API must:

  • Use and interpret HTTP headers correctly (e.g. HTTP PUT, POST, GET and DELETE)
  • Consume and return json
  • Supply a $links collection containing a self key, e.g.:
[
    {
        "$links": {
            "self": {
                "href": "/api/posts/postaa"
            }
        },
        "_id":"posta",
        "name":"Post A",
        "body":"Some content for Post A"
    }
]

Basic Usage

In your AngularJS application, include the JavaScript:

// your specific paths may vary
<script src="node_modules/radify/angular-model.js"></script>
<script src="node_modules/radify/angular-scaffold.js"></script>

In your app configuration, state a dependency on Angular Model and Angular Scaffold:

angular.module('myApp', [
	'ur.model',
	'ur.scaffold'
]);

Example controller using Angular Scaffold:

.controller('PostsController', function($scope, scaffold) {
	angular.extend($scope, {
		posts: scaffold('Posts', {})
	});
})

Basic CRUD example project

An example application is included in this repository. It has a very simple API that illustrates a basic use case for angular-scaffold.

To install and run the sample project:

cd sample-project
npm install
node server.js

You can then browse to http://localhost:4730/ and add/remove Post objects from a list. angular-scaffold takes care of talking to the API for you.

Pagination

angular-scaffold can paginate your model. Your API will need to support the Range: resources=n-n header to take advantage of this. For example, Range: resources=10-20 would return resources 10 through 20.

scaffold('Shares', {
paginate: { size: 20, page: 1, strategy: 'paged' }
});

Querying

You can pass a specific query in, which will be sent through to the API. Your API will have to know how to respond to this.

scaffold('Comments', {
  query: {
    offline: $scope.selected._id
  }
});

You can also pass in an ordering parameter. Again, your API will have to know what to do with it.

return scaffold('Shares', {
  query: { to: true, order: { _id: 'desc'} }
});