Expression based ID value

Description

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><!--   w ww. ja va 2 s.  c om-->
<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>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities