UserAgent
UserAgent is a light-weight service providing access to the user agent. It can help you do detect the browser, its version, the operating system, its version and the device type as well as help you building responsive UIs.
Classes
UserAgent
Defined in: user-agent.service.ts:13
UserAgent provides functionality related to the user-agent.
Example
// Check whether the viewport is considered a desktopconst { isDesktop } = UserAgent;
// You may also customize UserAgent's behaviorUserAgent.setOptions({ desktopBreakpoint: 1200 });Extends
any
Constructors
Constructor
new UserAgent():
UserAgent
Returns
Inherited from
ServiceMixin<UserAgent>().constructor
Accessors
isDesktop
Get Signature
get
staticisDesktop():boolean
Defined in: user-agent.service.ts:39
Whether the current viewport is considered a desktop.
Returns
boolean
Whether the current viewport is considered a desktop.
isMobile
Get Signature
get
staticisMobile():boolean
Defined in: user-agent.service.ts:50
Whether the current viewport is considered a mobile.
Returns
boolean
Whether the current viewport is considered a mobile.
options
Get Signature
get
staticoptions():UserAgentOptions
Defined in: user-agent.service.ts:31
Gets the UserAgents options.
Returns
The UserAgents options.
Methods
setOptions()
staticsetOptions(options):void
Defined in: user-agent.service.ts:23
Sets the UserAgents options.
Parameters
options
Partial<UserAgentOptions>
The options to use.
Returns
void
After the options have been set.
Interfaces
UserAgentOptions
Defined in: types.ts:4
The options for the UserAgent service.
Properties
desktopBreakpoint
desktopBreakpoint:
number
Defined in: types.ts:10
The minimum viewport width in pixels that will be considered a desktop device. Defaults to 960 pixels.
Default
960;