How to define and use strings in AngularJS

2 Answers

0 votes
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>

<div ng-app="" ng-init="str1='abc';str2='xyz'">

<p>The strings: {{ str1 + ", " + str2 }}</p>

</div> 

</body>
</html>

<!-- 
run: 

The strings: abc, xyz

-->

 



answered May 17, 2017 by avibootz
0 votes
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
 
<div ng-app="" ng-init="str1='abc';str2='xyz'">

<p>The strings: <span ng-bind="str1 + ' ' + str2"></span></p>
 
</div> 
 
</body>
</html>
 
<!-- 
run: 
 
The strings: abc, xyz
 
-->

 



answered May 18, 2017 by avibootz

Related questions

2 answers 307 views
2 answers 335 views
1 answer 299 views
1 answer 298 views
...