AngularJS Tutorial - Expression based ID value








The following code shows how to use . Expression to create element ID value.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!-- www  . ja v  a  2 s  . c o m-->
<body>
<div ng-app id="ng-app">
    <input type="radio" id="in{{1+1}}" name="lala"/>
    <label for="in{{2}}">Hello{{1}}</label>
    <input type="radio" id="in{{1+2}}" name="lala"/>
    <label for="in{{3}}">Hello{{2}}</label>
</div>

</body>


</html>

The code above is rendered as follows: