-
Notifications
You must be signed in to change notification settings - Fork 1
ModelService
Mihael Safaric edited this page Feb 20, 2019
·
6 revisions
Your resource services must extend ModelService
. ModelService
gives a communication interface for HTTP requests.
constructor(protected datastore: DatastoreService, private modelClass: {new(...args): Model });
findOne(modelId: string, requestOptions: RequestOptions = {}): Observable<Model>;
-
modelId
:string
-
requestOptions
:RequestOptions
- optional
- additional request options
find(params: object): Observable<Array<Model>>;
find(params: object, includeMeta: boolean): Observable<Array<Model>>;
find(params: object, includeMeta: boolean, requestOptions: RequestOptions): Observable<HalDocument<Model>>;
-
params
:object
- optional
- parameters which will be send in the reqest
-
includeMeta
:boolean
- optional
- if omitted or
falsy
,Observable<Array<Model>>
is returned - if
truthy
,Observable<HalDocument<Model>>
is returned (see HalDocument)
-
requestOptions
:RequestOptions
- optional
- additional request options
createNewModel(recordData: object = {}): Model
- locally creates an instance of a model class which is passed through the constructor,
modelClass
- NOTE: it does not tigger saving of newly created model