$ionicBody
An angular utility service to easily and efficiently add and remove CSS classes from the document’s body element.
Methods
addClass(class)
Add a class to the document’s body element.
Param | Type | Details |
---|---|---|
class |
string
|
Each argument will be added to the body element. |
- Returns:
$ionicBody
The $ionicBody service so methods can be chained.
removeClass(class)
Remove a class from the document’s body element.
Param | Type | Details |
---|---|---|
class |
string
|
Each argument will be removed from the body element. |
- Returns:
$ionicBody
The $ionicBody service so methods can be chained.
enableClass(shouldEnableClass, class)
Similar to the add
method, except the first parameter accepts a boolean
value determining if the class should be added or removed. Rather than writing user code,
such as “if true then add the class, else then remove the class”, this method can be
given a true or false value which reduces redundant code.
Param | Type | Details |
---|---|---|
shouldEnableClass |
boolean
|
A true/false value if the class should be added or removed. |
class |
string
|
Each remaining argument would be added or removed depending on the first argument. |
- Returns:
$ionicBody
The $ionicBody service so methods can be chained.
append(element)
Append a child to the document’s body.
Param | Type | Details |
---|---|---|
element |
element
|
The element to be appended to the body. The passed in element can be either a jqLite element, or a DOM element. |
- Returns:
$ionicBody
The $ionicBody service so methods can be chained.
get()
Get the document’s body element.
- Returns:
element
Returns the document’s body element.