API is a short form of Application Programming Interface. AngularJS provides a set of APIs to use in AngularJS application.
These APIs are called as Global API. We can access these APIs using angular object. Most commonly used Global API functions are listed below:
- lowercase() It converts string to lowercase
- uppercase() It converts strings to uppercase
- isString() It returns true if the reference is a string
- isNumber() It returns true if the reference is a number
Let’s understand using one example of angular.lowercase()
These APIs takes values as a parameter and after performing suitable actions, they return the result.
Using AngularJS Includes, we can include HTML from external html file. We use AngularJS directive ng-include including HTML.
Let’s see an example.
Output will be browser parsed HTML written in.
Include AngularJS Code in external file
Actually this directive replaces associated HTML element to the HTML available in external HTML file. So we can include AngularJS code as well. The code written in external file is also executed at runtime.
Include Cross Domain HTML files
By default, AngularJS does not allow include of external files which are available in other domain. We need to add a whitelist of legal and trusted files or domains n configuration function of AngularJS application.
Output will be HTML ofpage