Class HasOne

Hierarchy

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(attributes?: any, options?: any): Model

Parameters

  • attributes?: any optional
  • options?: any optional

Returns

Model

Properties

public attributes: any

public changed: Array<any>

public cid: string

public collectionType: any

public id: any

public idAttribute: string

public instance: any

public key: any

public keyContents: any

public options: any

public related: any

public relatedCollection: any

public relatedModel: any

public reverseRelation: any

public url: any

public urlRoot: any

public validationError: any

Methods

public addRelated(model: Model, options: any)

Parameters

  • model: Model
  • options: any

public bind(eventName: string, callback: Function, context?: any): any

Parameters

  • eventName: string
  • callback: Function
  • context?: any optional

Returns

any

public change(): any

Returns

any

public changedAttributes(attributes?: any): Array<any>

Parameters

  • attributes?: any optional

Returns

Array<any>

public checkPreconditions(): boolean

Returns

boolean

public clear(options?: Silenceable): any

Parameters

Returns

any

public clone(): Model

Returns

Model

public defaults(): any

Default attributes for the model. It can be an object hash or a method returning an object hash. For assigning an object hash, do it like this: this.defaults = { attribute: value, ... }; That works only if you set it in the constructor or the initialize method.

Returns

any

public destroy()

public escape(attribute: string): string

Parameters

  • attribute: string

Returns

string

public fetch(options?: ModelFetchOptions): JQueryXHR

Parameters

Returns

JQueryXHR

public findRelated(options: any): Model

Parameters

  • options: any

Returns

Model

public get(attributeName: string): any

Parameters

  • attributeName: string

Returns

any

public getReverseRelations(model: RelationalModel): Relation

Parameters

Returns

Relation

public handleAddition(model: Model, coll: Collection, options: any)

Parameters

public handleRemoval(model: Model, coll: Collection, options: any)

Parameters

public handleReset(coll: Collection, options: any)

Parameters

public has(attribute: string): boolean

Parameters

  • attribute: string

Returns

boolean

public hasChanged(attribute?: string): boolean

Parameters

  • attribute?: string optional

Returns

boolean

public initialize(attributes?: any)

Parameters

  • attributes?: any optional

public invert(): any

Returns

any

public isNew(): boolean

Returns

boolean

public isValid(options?: any): boolean

Parameters

  • options?: any optional

Returns

boolean

public keys(): Array<string>

Returns

Array<string>

public listenTo(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public listenToOnce(object: any, events: string, callback: Function): any

Parameters

  • object: any
  • events: string
  • callback: Function

Returns

any

public off(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public omit(keys: Array<string>): any

Parameters

  • keys: Array<string>

Returns

any

public omit(keys?: Array<string>): any

Parameters

  • keys?: Array<string> optional

Returns

any

public on(eventName: string, callback?: Function, context?: any): any

Parameters

  • eventName: string
  • callback?: Function optional
  • context?: any optional

Returns

any

public onChange(model: Model, attr: any, options: any)

Parameters

  • model: Model
  • attr: any
  • options: any

public once(events: string, callback: Function, context?: any): any

Parameters

  • events: string
  • callback: Function
  • context?: any optional

Returns

any

public pairs(): Array<any>

Returns

Array<any>

public parse(response: any, options?: any): any

Parameters

  • response: any
  • options?: any optional

Returns

any

public pick(keys: Array<string>): any

Parameters

  • keys: Array<string>

Returns

any

public pick(keys?: Array<string>): any

Parameters

  • keys?: Array<string> optional

Returns

any

public previous(attribute: string): any

Parameters

  • attribute: string

Returns

any

public previousAttributes(): Array<any>

Returns

Array<any>

public removeRelated(model: Model, coll: any, options: any)

Parameters

  • model: Model
  • coll: any
  • options: any

public save(attributes?: any, options?: ModelSaveOptions): any

Parameters

Returns

any

public set(attributeName: string, value: any, options?: ModelSetOptions): Model

Parameters

Returns

Model

public set(obj: any, options?: ModelSetOptions): Model

Parameters

Returns

Model

public setKeyContents(keyContents: string)

Parameters

  • keyContents: string

public setKeyContents(keyContents: Array<string>)

Parameters

  • keyContents: Array<string>

public setKeyContents(keyContents: number)

Parameters

  • keyContents: number

public setKeyContents(keyContents: Array<number>)

Parameters

  • keyContents: Array<number>

public setKeyContents(keyContents: Collection)

Parameters

public setRelated(related: Model)

Parameters

public setRelated(related: Collection)

Parameters

public stopListening(object?: any, events?: string, callback?: Function): any

Parameters

  • object?: any optional
  • events?: string optional
  • callback?: Function optional

Returns

any

public sync(arg?: Array<any>): JQueryXHR

Parameters

  • arg?: Array<any> optional

Returns

JQueryXHR

public toJSON(options?: any): any

Parameters

  • options?: any optional

Returns

any

public trigger(eventName: string, args?: Array<any>): any

Parameters

  • eventName: string
  • args?: Array<any> optional

Returns

any

public tryAddRelated(model: Model, coll: any, options: any)

Parameters

  • model: Model
  • coll: any
  • options: any

public unbind(eventName?: string, callback?: Function, context?: any): any

Parameters

  • eventName?: string optional
  • callback?: Function optional
  • context?: any optional

Returns

any

public unset(attribute: string, options?: Silenceable): Model

Parameters

Returns

Model

public validate(attributes: any, options?: any): any

Parameters

  • attributes: any
  • options?: any optional

Returns

any

public values(): Array<any>

Returns

Array<any>