AngularJS Strings


AngularJS Strings : AngularJS String works same as the javaScript strings. You can perform operation same as the javaScript string.


AngularJS Strings simple Example using Expressions

<div ng-app="" ng-init="str1='John';str2='UK'" >

    <p>Hi This is {{str1 + " From " + str2}}</p>

</div>

Example 1

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
</head>

<body>
<div ng-app="" ng-init="str1='John';str2='UK'" >

    <p>Hi This is {{str1 + " From " + str2}}</p>

</div>

</body>
</html>

Try it »

Example of String with ng-bind

Example 2

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
</head>
<body>
<div ng-app="" ng-init="str1='John';str2='UK'" >

    <p>Hi This is <span ng-bind ="str1 + ' From ' + str2"></span></p>

</div>
</body>
</html>

Try it »


Advertisements

Add Comment

📖 Read More