AngularJS Built-in Functions

Before proceeding with this topic, I would like that you first go through the basics of AngularJS by visiting the following links:

Now in this article I will share some knowledge about AngularJS built-in functions. Some of the functions are:

  1. UpperCase(str)

    This AngularJS function is used to convert a lowercase letter to uppercase.

    Example

    Here in this example I have explained how to convert a lowercase letter to uppercase.

    The code for the controller part and the UI part is shown in the following screenshot:

    controller

    The UI will be like the following:

    click

    After clicking the button the text will change to uppercase as in the following:

    message

  2. LowerCase(str)

    This AngularJS function converts an uppercase letter to lowercase.

    Example

    Here, I explained how to convert an uppercase letter to lowercase on button click.

    code

    The UI will be like the following:

    UI

    After clicking the button, you can see the following result:

    function

  3. forEach(obj, iterator, [context])

    This function is used to read each element or iterate through each element from an array.

    Example

    Here I have explained how to read each element of an array using a foreach loop.

    array using foreach loop

    The following is the UI:

    UI is

    When we click the button the result will be the following:

    output

  4. extend({}, obj1, obj2,)

    The extend method will be similar to a copy and paste operation. It will copy data from one or more sources and then paste it in another source or destination.

    Example

    Here I have explained how to copy elements from one source and paste in another destination.

    elements

    The following is the UI:

    click

    After clicking the button the following will be the result:

    result

  5. isString(value)

    This function is used to check if it is a string or not. If it is a string it will return true else it will return false.

    Example

    Here is the code for that:

    string

    The UI is:

    click

    And the following is the output after clicking the button:

    true false

  6. IsNumber(value): This is used for checking if a value is a number or not. If it is a number it will return true else it will return false.

    Example

    Here I will explain it using the following example:

    IsNumber

    The following is the UI:

    click

    The output will be the following:

    true false

  7. isArray(value)

    This function is used to check if the value is an array or not.

    Example

    Example

    The following is the UI:

    The UI for this is

    The following is the output:

    true false

Here in this tutorial I explained these functions. In my future articles I will explain all the remaining functions. I hope this article will provide much more clarity about the functions in AngularJS.