Tag Archives: AngularJs Api tutorials
a โ Anchor Tag Directive
a โ Anchor Tag Directive: This directive modifies the default behaviour of the anchor tag in AngularJs. If you leave href attribute value null then default action will be prevented. Here in this tutorial we are going to explain how you can use anchor tags in AngularJs. You can use our online editor to edit and run the code online.
a โ Anchor Tag Directive | Anchor Tag in AngularJs | Example
Sytax for a is as below-
Syntax โ
angular.merge Syntax
... |
AngularJs Modifiy the default behaviour of the anchor(..). If the value of href attribute is blank it will prevent the default action. So if you want to call a function using ng-click and prevent the href action just leave the href attribute null.
Now let us create a simple example to understand the default and the AngularJs anchor tage behaviour .
Example
a โ Anchor Tag Directive
|
If you click on the above two anchors you will clearly see the difference in the href Action. Angular will stop action while in second example it will call the function and redirect to same url.
If you run the above example it will produce the output something like this โ
angular.merge
angular.merge: This function is used to merge two objects in AngularJs. You can also use this function to merge multiple objects. Here in this tutorial we are going to explain how you can use this function to merge objects in AngularJs. You can use our online editor to edit and run the code online.
angular.merge โ AngularJs Merge Objects | Example
Sytax for angular.merge is as below-
Syntax โ
angular.merge Syntax
angular.merge(src, dst); |
The above function copies the numerable properties from the src(source) object(s) to dst(destination).
Arguments
- src : Source Object.
- dst : Destination Object.
Returns
- Object : Reference to dst.
Now let us create a simple example to understand the above function.
Example
AngularJs Merge Objects Example
|
The above example will merge the object b into object a.
If you run the above example it will produce the output something like this โ
angular.isUndefined
angular.isUndefined: This function is used to check undefined variable in AngularJs. The function angular.isUndefined will return true if passed variable is undefined else it will return false. Here in this tutorial we are going to explain how you can use this function to determine a undefined variable in AngularJs. You can use our online editor to edit and run the code online.
angular.isUndefined โ AngularJs check undefined value | Example
Sytax for angular.isUndefined is as below-
Syntax โ
angular.isUndefined Syntax
angular.isUndefined(value); |
The above function checks whether the passed variable is undefined or not and on the basis of that it returns true or false.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference is not defined ie. undefined else it will return false.
Now let us create a simple example to understand the above function.
Example
AngularJs check undefined value | Variable Example
|
If you run the above example it will produce the output something like this โ
angular.isString
angular.isString: This function is used to check whether a reference is string or not. The function isString will return true if passed reference is string else it will return false. Here in this tutorial we are going to explain how you can use this function to determine a string in AngularJs. You can use our online editor to edit and run the code online.
angular.isString โ Check if Reference is String | Example
Sytax for angular.isString is as below-
Syntax โ
angular.isString Syntax
angular.isString(value); |
The above function checks whether the passed string(reference) is String or not and on the basis of that it returns true or false.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference is String else it will return false.
Now let us create a simple example to understand the above function.
Example
AngularJs check string type: Check If String
|
If you run the above example it will produce the output something like this โ
angular.isObject
angular.isObject: This function is used to check whether a reference is object or not. The function angular.isObject will return true if passed reference is object else it will return false. Here in this tutorial we are going to explain how you can use this function to determine an object in AngularJs. You can use our online editor to edit and run the code online.
angular.isObject โ Check if Reference is object | Example
Sytax for angular.isObject is as below-
Syntax โ
angular.isObject Syntax
angular.isObject(value); |
The above function checks whether the passed string(reference) is isObject or not and on the basis of that it returns true or false.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference is object else it will return false.
Now let us create a simple example to understand the above function.
Example
AngularJs check object type: Check If Object
|
If you run the above example it will produce the output something like this โ
angular.isNumber
angular.isNumber: This function is used to check whether a string(reference) is number or not. The function isFunction will return true if passed reference is function else it will return false.
angular.isNumber โ Check if string is number | Example
Sytax for angular.isElement is as below-
Syntax โ
angular.isNumber Syntax
angular.isNumber(value); |
The above function checks whether the passed string(reference) is number or not.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference is number else it will return false.
Now let us create a simple example to understand the above function.
Example
angular.isNumber โ Validate number Example
|
If you run the above example it will produce the output something like this โ
angular.isFunction
angular.isFunction โ This Checks if reference is a Function : angular.isFunction function is used to check whether a reference is fuction or not. The function isFunction will return true if passed reference is function else it will return false.
angular.isElement โ Check if reference is function
Sytax for angular.isElement is as below-
Syntax โ
angular.isFunction Syntax
angular.isElement(value); |
The above function checks whether the passed reference is function or not.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference function else it will return false.
angular.isElement โ Check if element
angular.isElement โ Check if element : angular.isElement function is used to check whether a reference is DOM element or not. Let us understand this function with complete syntax and details.
angular.isElement โ Check if element
Sytax for angular.isElement is as below-
Syntax โ
angular.isElement Syntax
angular.isElement(value); |
The above function checks whether the passed reference is DOM element or not.
Arguments
- value : This is reference to check.
Returns
- boolean : Returns true if reference is DOM element else it will return false.
Angularjs check defined variable
Angularjs check defined variable : angular.isDefined() function is used to identify whether a variable is defined or not. Here in this tutorial we are going to explain how to check defined variables using the function angular.isDefined() in AngularJs. You can also use our online tool to run and edit the code.
Angularjs check defined variable | angular.isDefined | Example
To check a defined variable you can use angular.isDefined() function, it will return true if the variable is defined else it will return false. Here is an example of checking defined variable using angular.isDefined() function.
Angularjs check defined variable | angular.isDefined | Example:
|
After running the above example it will produce output something like this โ