mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-09 09:00:34 +08:00
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.
|
||||
*
|
||||
* @example
|
||||
<example>
|
||||
<example module="initExample">
|
||||
<file name="index.html">
|
||||
<script>
|
||||
function Ctrl($scope) {
|
||||
$scope.list = [['a', 'b'], ['c', 'd']];
|
||||
}
|
||||
angular.module('initExample', [])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.list = [['a', 'b'], ['c', 'd']];
|
||||
}]);
|
||||
</script>
|
||||
<div ng-controller="Ctrl">
|
||||
<div ng-controller="ExampleController">
|
||||
<div ng-repeat="innerList in list" ng-init="outerIndex = $index">
|
||||
<div ng-repeat="value in innerList" ng-init="innerIndex = $index">
|
||||
<span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
|
||||
|
||||
Reference in New Issue
Block a user