APIs

Show:

Devices detection service. Uses devicejs with noConflict, duplicates all devicejs methods inside service & implements some new methods.

Methods

_onOrientationChange

() private

Handles window's 'resize' & 'orientationchange' events.

isDesktop

() Boolean

Get current device is desktop.

Returns:

Boolean:

Returns true, if device is desktop.

isMobile

() Boolean

Get current device is phone.

Returns:

Boolean:

Returns true, if device is phone.

isMobile

() Boolean

Get current device is phone.

Returns:

Boolean:

Returns true, if device is phone.

isTablet

() Boolean

Get current device is tablet.

Returns:

Boolean:

Returns true, if device is tablet.

orientation

(
  • useCached
)
String

Returns current device orientation.

Parameters:

  • useCached Boolean

    Flag: indicates whether to use already cached value or not.

Returns:

String:

Returns current device orientation ('landscape' or 'portrait').

pathPrefixes

(
  • useCached
)
String[]

Returns path prefixes for application resources (such as templates, controllers, ...), related to current device platform, type, and orientation.

Parameters:

  • useCached Boolean

    Flag: indicates whether to use already cached value or not.

Returns:

String[]:

Path prefixes for application resources (such as templates, components...), related to current platform, device type, and orientation.

platform

(
  • useCached
)
String

Returns current device platform.

Parameters:

  • useCached Boolean

    Flag: indicates whether to use already cached value or not.

Returns:

String:

Returns device platform ('windows', ios', 'android', 'blackberry', 'fxos', 'meego', ...).

type

(
  • useCached
)
String

Returns current device type.

Parameters:

  • useCached Boolean

    Flag: indicates whether to use already cached value or not.

Returns:

String:

Returns device type ('desktop', 'phone', 'tablet', 'tv', ...).

Properties

_cache

Object private

Device service cache.

Sub-properties:

  • orientation String

    Cached orientation ('portrait' or 'landscape').

  • platform String

    Cached platform ('ios', 'windows', 'android', ...).

  • type String

    Cached device type ('desktop', 'phone', 'tablet', or 'tv').

  • pathPrefixes Object

    Cached path prefixes.

  • pathPrefixes.landscape String[]

    Cached path prefixes for 'landscape' orientation (for example 'ipad-landscape', 'ipad', 'tablet-landscape', 'tablet', 'mobile-landscape', 'mobile').

  • pathPrefixes.portrait String[]

    Cached path prefixes for 'portrait' orientation (for example 'ipad-portrait', 'ipad', 'tablet-portrait', 'tablet', 'mobile-portrait', 'mobile').

prefixForOrientation

Boolean

If set as true, each prefix for paths, returned by pathPrefixes function, will be duplicated in format: 'prefix-currentOrientation'.

Default: false

prefixForPlatformAndType

Boolean

If set as true, into prefixes for paths, returned by pathPrefixes function, will be added prefix in format: 'platformName-deviceType'.

Default: false

prefixForType

Boolean

If set as true, into prefixes for paths, returned by pathPrefixes function, will be added prefix in format: 'deviceType'.

Default: false