docs(ngInit): update example to use a module
This commit is contained in:
@@ -29,14 +29,15 @@
|
|||||||
* @param {expression} ngInit {@link guide/expression Expression} to eval.
|
* @param {expression} ngInit {@link guide/expression Expression} to eval.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
<example>
|
<example module="initExample">
|
||||||
<file name="index.html">
|
<file name="index.html">
|
||||||
<script>
|
<script>
|
||||||
function Ctrl($scope) {
|
angular.module('initExample', [])
|
||||||
$scope.list = [['a', 'b'], ['c', 'd']];
|
.controller('ExampleController', ['$scope', function($scope) {
|
||||||
}
|
$scope.list = [['a', 'b'], ['c', 'd']];
|
||||||
|
}]);
|
||||||
</script>
|
</script>
|
||||||
<div ng-controller="Ctrl">
|
<div ng-controller="ExampleController">
|
||||||
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
|
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
|
||||||
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
|
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
|
||||||
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
|
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user