Interface DurandalViewLocatorModule

Index

Methods

Methods

public convertModuleIdToViewId(moduleId: string): string

Converts a module id into a view id. By default the ids are the same.

Parameters

  • moduleId: string

    The module id.

Returns

string

The view id.

public determineFallbackViewId(obj: any): string

If no view id can be determined, this function is called to genreate one. By default it attempts to determine the object's type and use that.

Parameters

  • obj: any

    The object to determine the fallback id for.

Returns

string

The view id.

public locateView(view: HTMLElement, area?: string, elementsToSearch?: Array<HTMLElement>): JQueryPromise

Locates the specified view.

Parameters

  • view: HTMLElement

    A view. It will be immediately returned.

  • area?: string optional
  • elementsToSearch?: Array<HTMLElement> optional

Returns

JQueryPromise

A promise of the view.

public locateView(viewUrlOrId: string, area?: string, elementsToSearch?: Array<HTMLElement>): JQueryPromise

Locates the specified view.

Parameters

  • viewUrlOrId: string

    A view url or view id to locate.

  • area?: string optional
  • elementsToSearch?: Array<HTMLElement> optional

Returns

JQueryPromise

A promise of the view.

public locateViewForObject(obj: any, area: string, elementsToSearch?: Array<HTMLElement>): JQueryPromise

Maps an object instance to a view instance.

Parameters

  • obj: any

    The object to locate the view for.

  • area: string
  • elementsToSearch?: Array<HTMLElement> optional

Returns

JQueryPromise

A promise of the view.

public translateViewIdToArea(viewId: string, area: string): string

Takes a view id and translates it into a particular area. By default, no translation occurs.

Parameters

  • viewId: string

    The view id.

  • area: string

    The area to translate the view to.

Returns

string

The translated view id.

public useConvention(modulesPath?: string, viewsPath?: string, areasPath?: string)

Allows you to set up a convention for mapping module folders to view folders. It is a convenience method that customizes convertModuleIdToViewId and translateViewIdToArea under the covers.

Parameters

  • modulesPath?: string optional
  • viewsPath?: string optional
  • areasPath?: string optional