Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d28a0bf

Browse files
committed
docs(ngInclude): update example to use a module
1 parent d35f50e commit d28a0bf

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/ng/directive/ngInclude.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
* - Otherwise enable scrolling only if the expression evaluates to truthy value.
4444
*
4545
* @example
46-
<example module="ngAnimate" deps="angular-animate.js" animations="true">
46+
<example module="includeExample" deps="angular-animate.js" animations="true">
4747
<file name="index.html">
48-
<div ng-controller="Ctrl">
48+
<div ng-controller="ExampleController">
4949
<select ng-model="template" ng-options="t.name for t in templates">
5050
<option value="">(blank)</option>
5151
</select>
@@ -57,12 +57,13 @@
5757
</div>
5858
</file>
5959
<file name="script.js">
60-
function Ctrl($scope) {
61-
$scope.templates =
62-
[ { name: 'template1.html', url: 'template1.html'},
63-
{ name: 'template2.html', url: 'template2.html'} ];
64-
$scope.template = $scope.templates[0];
65-
}
60+
angular.module('includeExample', ['ngAnimate'])
61+
.controller('ExampleController', ['$scope', function($scope) {
62+
$scope.templates =
63+
[ { name: 'template1.html', url: 'template1.html'},
64+
{ name: 'template2.html', url: 'template2.html'} ];
65+
$scope.template = $scope.templates[0];
66+
}]);
6667
</file>
6768
<file name="template1.html">
6869
Content of template1.html

0 commit comments

Comments
 (0)