ng-include inline template

Description

The following code shows how to use ng-include to include inline template.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--   w ww .ja  v a 2 s .  co m-->
<body>
  <html ng-app>
    <head>
    <script type="text/ng-template" id="foo.html">
           FOO
    </script>

    <script type="text/ng-template" id="bar.html">
            BAR
    </script>
    </head>
    <body>

        <ng-include src="'foo.html'"></ng-include>
        <ng-include src="'bar.html'"></ng-include>

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

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities