What is AngularJS API and Include

AngularJS API

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:

  1. lowercase() It converts string to lowercase
  2. uppercase() It converts strings to uppercase
  3. isString() It returns true if the reference is a string
  4. isNumber() It returns true if the reference is a number

Let’s understand using one example of angular.lowercase()

Output

These APIs takes values as a parameter and after performing suitable actions, they return the result.

 

AngularJS Includes

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 myFile.htm.

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 of angular_include.asp page

 

Be Connected…

Satyendra

,

About Satyendra Mishra

Satyendra is a Technical Project Manager with 12+ years of experience on Project Management, Microsoft Technologies including ASP.NET, ASP.NET MVC, C#, SharePoint (On premises & Office 365), JavaScript Framework (AngularJS) and related technologies. He is a person with belief, sky is limit for a hard working and dedicated individual. That’s why he devoted himself to field of Software Development and now both are growing with each other. Every year for him turned out to be best year and he received enormous support and love from his companies and his clients from around the world. Now with vast knowledge of software development and its outsourcing process, he decided to move himself into knowledge sharing. Keep a fact in your mind about the comfort level of your clients and this will make you king/queen of your area.
View all posts by Satyendra Mishra →

Leave a Reply

Your email address will not be published. Required fields are marked *