GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - radify/angular-scaffold: Simple scaffolding for AngularJS

BranchesTags
Open more actions menu

Latest commit

 

History

56 Commits
56 Commits

Folders and files

NameName
Last commit message
Last commit date
config
config
 
 
docs
docs
 
 
sample-project
sample-project
 
 
spec
spec
 
 
src
src
 
 
.codeclimate.yml
.codeclimate.yml
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
.travis.yml
.travis.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Gulpfile.js
Gulpfile.js
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 

Repository files navigation

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

  • AngularJS
  • Angular Model

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'} }
});

About

Simple scaffolding for AngularJS

Resources

Readme
BSD-3-Clause license

Contributing

Contributing
Activity
Custom properties

Stars

4 stars

Watchers

3 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.