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

Skip to content

Commit aecdd9d

Browse files
committed
docs(ngInit): update example to use a module
1 parent 1534529 commit aecdd9d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ng/directive/ngInit.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
2929
* @param {expression} ngInit {@link guide/expression Expression} to eval.
3030
*
3131
* @example
32-
<example>
32+
<example module="initExample">
3333
<file name="index.html">
3434
<script>
35-
function Ctrl($scope) {
36-
$scope.list = [['a', 'b'], ['c', 'd']];
37-
}
35+
angular.module('initExample', [])
36+
.controller('ExampleController', ['$scope', function($scope) {
37+
$scope.list = [['a', 'b'], ['c', 'd']];
38+
}]);
3839
</script>
39-
<div ng-controller="Ctrl">
40+
<div ng-controller="ExampleController">
4041
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
4142
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
4243
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>

0 commit comments

Comments
 (0)