API Docs for: 0.1.6
Show:

NgModel Class

Defined in: temp/NgModel.js:252

Modellayer for AngularJS

Constructor

NgModel

(
  • [properties]
)

Defined in temp/NgModel.js:252

Parameters:

  • [properties] Object optional

    Start properties of record.

Methods

buildUrl

(
  • operation
  • [options]
)
String private

Defined in temp/NgModel.js:715

Put together url for request.

Parameters:

  • operation String

    Indicates which operation should be done.

  • [options] Object optional

    Batch options.

Returns:

String:

callParent

(
  • [args]
)
Mixed private

Defined in temp/NgModel.js:890

Call parent class method

Parameters:

  • [args] Mixed optional

    Arguments you need in the parent method.

Returns:

Mixed:

callParent

(
  • [args]
)
Mixed private static

Defined in temp/NgModel.js:354

Call parent class method

Parameters:

  • [args] Mixed optional

    Arguments you need in the parent method.

Returns:

Mixed:

changedProperties

(
  • [diff]
)
Object

Defined in temp/NgModel.js:534

Create object which contains all changed properties.

Parameters:

  • [diff] Object optional

    An object to diff against, determining if there would be a change.

Returns:

Object:

create

(
  • [properties]
  • [statics]
)
Function static

Defined in temp/NgModel.js:267

Create new child type of model.

Parameters:

  • [properties] Object optional

    prototypeProperties for child model prototype.

  • [statics] Object optional

    staticProperties for child model static properties.

Returns:

Function:

Constructor

destroy

(
  • [options]
)

Defined in temp/NgModel.js:665

Delete a record.

Parameters:

  • [options] Object optional

    Additonal request options.

Returns:

$q.promise

extend

(
  • data
)
NgModel

Defined in temp/NgModel.js:878

Easily extend the data object of your model.

Parameters:

  • data Object

    Data to extend.

Returns:

fetch

(
  • [options]
)

Defined in temp/NgModel.js:588

Read a record.

Parameters:

  • [options] Object optional

    Additonal request options.

Returns:

$q.promise

fetchAll

(
  • [options]
)
static

Defined in temp/NgModel.js:319

Fetch collection of records.

Parameters:

  • [options] Object optional

    Additional options for request.

Returns:

$q.promise

fetchOne

(
  • id
  • [options]
)
static

Defined in temp/NgModel.js:304

Fetch one record.

Parameters:

  • id Mixed
  • [options] Object optional

    Additional options for request.

Returns:

$q.promise

get

(
  • key
)
Mixed

Defined in temp/NgModel.js:828

Getter for certain data properties.

Parameters:

  • key String

    Namespace for value you want to get.

Returns:

Mixed:

getId

() Mixed

Defined in temp/NgModel.js:806

Get id of record.

Returns:

Mixed:

getRequestData

() Object private

Defined in temp/NgModel.js:795

Process data for batch (advised to extend as soon as you want extended data processing for requests).

Returns:

Object:

hasChanged

(
  • [property]
)
Boolean

Defined in temp/NgModel.js:512

Check if model data has changed since the last sync.

Parameters:

  • [property] String optional

    Property to control.

Returns:

Boolean:

initialize

(
  • [properties]
  • [options]
)
private

Defined in temp/NgModel.js:480

Model initialization

Parameters:

  • [properties] Object optional

    Start properties of record.

  • [options] Object optional

    Additional options for model.

isNew

() Boolean

Defined in temp/NgModel.js:762

Indicates if record is new or not (important for save/update operation).

Returns:

Boolean:

parse

(
  • data
  • [options]
)
Object private

Defined in temp/NgModel.js:745

Parse raw data from request response.

Parameters:

  • data Object

    Raw request response data.

  • [options] Object optional

    Request options.

Returns:

Object:

previous

(
  • property
)
Mixed

Defined in temp/NgModel.js:564

Get the state of a property before the last change.

Parameters:

  • property String

    Property which you want to get.

Returns:

Mixed:

previousProperties

() Object

Defined in temp/NgModel.js:578

Get the state of data before the last change.

Returns:

Object:

range

(
  • []
)
Object

Defined in temp/NgModel.js:852

Create a new object which all filtered data wanted.

Parameters:

  • [] Mixed optional multiple

    Property string you want to export or object with from/to information like {'myProp':'myNewProp'}.

Returns:

Object:

save

(
  • [options]
)

Defined in temp/NgModel.js:626

Save/Update a record.

Parameters:

  • [options] Object optional

    Additonal request options.

Returns:

$q.promise

set

(
  • key
  • value
)
Mixed

Defined in temp/NgModel.js:839

Setter for certain data properties.

Parameters:

  • key String

    Namespace for value you want to set.

  • value Mixed

    Value you want to set.

Returns:

Mixed:

setId

(
  • id
)
Mixed

Defined in temp/NgModel.js:816

Change id of record.

Parameters:

  • id Mixed

    Id value for record.

Returns:

Mixed:

sync

(
  • operation
  • model
  • [options]
)
private

Defined in temp/NgModel.js:692

Sync a record.

Parameters:

  • operation String

    Indicates which operation should be done.

  • model NgModel

    Record used for request.

  • [options] Object optional

    Additonal request options.

Returns:

$q.promise

toJSON

() Object

Defined in temp/NgModel.js:772

Getter for data property.

Returns:

Object:

toScope

(
  • scope
  • key
)
NgModel

Defined in temp/NgModel.js:782

Easy way to extend model to a scope.

Parameters:

  • scope Object

    Scope you want to add the model.

  • key String

    Property where you want to add the model to.

Returns:

Properties

actionMethods

Object

Defined in temp/NgModel.js:438

Define your model crud schema.

Default: {'create': 'POST','read': 'GET','update': 'PUT','delete': 'DELETE'}

api

Object

Defined in temp/NgModel.js:452

Specify certain url for certain operations (optional).

Default: {'create': null,'read': null,'update': null,'delete': null}

appendData

Object

Defined in temp/NgModel.js:466

Specify for which operation your model should append data to the request.

Default: {'create': true,'read': false,'update': true,'delete': false}

defaultData

Object

Defined in temp/NgModel.js:375

The default propertiers of a record.

Default: {}

headers

Object

Defined in temp/NgModel.js:384

The default headers for a request.

Default: {}

idProperty

String

Defined in temp/NgModel.js:366

The default namespace for the id property.

Default: "id"

notPersist

Array

Defined in temp/NgModel.js:429

Exclude non persit data from request.

Default: []

readFilters

Object

Defined in temp/NgModel.js:411

Filter for data processing when reading.

Default: null

resultRoot

String

Defined in temp/NgModel.js:393

The root namespace which contain the data.

Default: null

url

String

Defined in temp/NgModel.js:402

The main request url.

Default: null

writeFilters

Object

Defined in temp/NgModel.js:420

Filter for data processing when writing.

Default: null