NgModel Class
Modellayer for AngularJS
Constructor
NgModel
-
[properties]
Parameters:
-
[properties]
Object optionalStart properties of record.
Item Index
Methods
- buildUrl
- callParent
- callParent static
- changedProperties
- create static
- destroy
- extend
- fetch
- fetchAll static
- fetchOne static
- get
- getId
- getRequestData
- hasChanged
- initialize
- isNew
- parse
- previous
- previousProperties
- range
- save
- set
- setId
- sync
- toJSON
- toScope
Methods
buildUrl
-
operation
-
[options]
Put together url for request.
Parameters:
-
operation
StringIndicates which operation should be done.
-
[options]
Object optionalBatch options.
Returns:
callParent
-
[args]
Call parent class method
Parameters:
-
[args]
Mixed optionalArguments you need in the parent method.
Returns:
callParent
-
[args]
Call parent class method
Parameters:
-
[args]
Mixed optionalArguments you need in the parent method.
Returns:
changedProperties
-
[diff]
Create object which contains all changed properties.
Parameters:
-
[diff]
Object optionalAn object to diff against, determining if there would be a change.
Returns:
create
-
[properties]
-
[statics]
Create new child type of model.
Parameters:
-
[properties]
Object optionalprototypeProperties for child model prototype.
-
[statics]
Object optionalstaticProperties for child model static properties.
Returns:
Constructor
destroy
-
[options]
Delete a record.
Parameters:
-
[options]
Object optionalAdditonal request options.
Returns:
$q.promise
extend
-
data
Easily extend the data object of your model.
Parameters:
-
data
ObjectData to extend.
Returns:
fetch
-
[options]
Read a record.
Parameters:
-
[options]
Object optionalAdditonal request options.
Returns:
$q.promise
fetchAll
-
[options]
Fetch collection of records.
Parameters:
-
[options]
Object optionalAdditional options for request.
Returns:
$q.promise
fetchOne
-
id
-
[options]
Fetch one record.
Parameters:
-
id
Mixed -
[options]
Object optionalAdditional options for request.
Returns:
$q.promise
get
-
key
Getter for certain data properties.
Parameters:
-
key
StringNamespace for value you want to get.
Returns:
getId
()
Mixed
Get id of record.
Returns:
getRequestData
()
Object
private
Process data for batch (advised to extend as soon as you want extended data processing for requests).
Returns:
hasChanged
-
[property]
Check if model data has changed since the last sync.
Parameters:
-
[property]
String optionalProperty to control.
Returns:
initialize
-
[properties]
-
[options]
Model initialization
Parameters:
-
[properties]
Object optionalStart properties of record.
-
[options]
Object optionalAdditional options for model.
isNew
()
Boolean
Indicates if record is new or not (important for save/update operation).
Returns:
parse
-
data
-
[options]
Parse raw data from request response.
Parameters:
-
data
ObjectRaw request response data.
-
[options]
Object optionalRequest options.
Returns:
previous
-
property
Get the state of a property before the last change.
Parameters:
-
property
StringProperty which you want to get.
Returns:
previousProperties
()
Object
Get the state of data before the last change.
Returns:
range
-
[]
Create a new object which all filtered data wanted.
Parameters:
-
[]
Mixed optional multipleProperty string you want to export or object with from/to information like {'myProp':'myNewProp'}.
Returns:
save
-
[options]
Save/Update a record.
Parameters:
-
[options]
Object optionalAdditonal request options.
Returns:
$q.promise
set
-
key
-
value
Setter for certain data properties.
Parameters:
-
key
StringNamespace for value you want to set.
-
value
MixedValue you want to set.
Returns:
setId
-
id
Change id of record.
Parameters:
-
id
MixedId value for record.
Returns:
sync
-
operation
-
model
-
[options]
Sync a record.
Parameters:
-
operation
StringIndicates which operation should be done.
-
model
NgModelRecord used for request.
-
[options]
Object optionalAdditonal request options.
Returns:
$q.promise
toJSON
()
Object
Getter for data property.
Returns:
Properties
actionMethods
Object
Define your model crud schema.
Default: {'create': 'POST','read': 'GET','update': 'PUT','delete': 'DELETE'}
api
Object
Specify certain url for certain operations (optional).
Default: {'create': null,'read': null,'update': null,'delete': null}
appendData
Object
Specify for which operation your model should append data to the request.
Default: {'create': true,'read': false,'update': true,'delete': false}
defaultData
Object
The default propertiers of a record.
Default: {}
headers
Object
The default headers for a request.
Default: {}
idProperty
String
The default namespace for the id property.
Default: "id"
notPersist
ArrayExclude non persit data from request.
Default: []
readFilters
Object
Filter for data processing when reading.
Default: null
resultRoot
String
The root namespace which contain the data.
Default: null
url
String
The main request url.
Default: null
writeFilters
Object
Filter for data processing when writing.
Default: null