Skip to content

Latest commit

 

History

History
470 lines (389 loc) · 8.24 KB

api.md

File metadata and controls

470 lines (389 loc) · 8.24 KB

angular-scaffold API documentation

scaffold

service in module ur

Description

Provider for angular-scaffold

 var s = scaffold("Dogs", {
  paginate: { size: 1, strategy: 'infinite' }
});

Dependencies

angular

model

Methods

create()

Creates a new object when the deferred promise is resolved

Returns
object

Deferred promise

delete(index)

Find index and delete it from the API, then remove it from the collection

Parameters
Param Type Details
index numberobject

Either the index of the item in the collection to remove, or the object itself, which will be searched for in the collection

Returns
object

Promise

edit(index)

Find index and set it up for editing.

Updates the object when the deferred promise is resolved

Parameters
Param Type Details
index numberobject

Either the index of the item in the collection to edit, or the object itself, which will be searched for in the collection

Returns
object

Deferred promise

$config()

Get the configuration for this angular-scaffold instance

Returns
object

Configuration of this angular-scaffold instance

$init()

Initialise this scaffold

Returns
object

Returns this object, supporting method chaining

model()

Returns the configuration for this angular-scaffold instance

Returns
string

The underlying model this object is configured with

page(page)

Select a page

Parameters
Param Type Details
page number

Page of results to show

Returns
object

Configuration of this angular-scaffold instance

query(query, page)

Get the configuration for this angular-scaffold instance

Parameters
Param Type Details
query object

e.g. { name: 'name to search for' }

page
(optional)
number

If supplied, used to determine which page of results to show

Returns
object

Configuration of this angular-scaffold instance

refresh(options)

Go to the API and refresh

Parameters
Param Type Details
options
(optional)
object

Query options to pass to the underlying angular-model all query

Returns
object

Returns this object, supporting method chaining

total()

How many results in total are in the scaffold (not just the current page)

Returns
number

Total results

Properties

$ui

User interface related convenience properties, so in your UI, you can show saving and loading states

pages

the count of pages that the API reported to the scaffold

scaffold

function in module ur

Description

Configure a scaffold

Usage

scaffold(name[, options]);

Parameters

Param Type Details
name string

The name

options
(optional)
object

Configuration object

Returns

object

Created scaffold object

Example

var s = scaffold("Dogs", { paginate: true });