mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
docs(ngSwitch): update example to use a module
This commit is contained in:
@@ -55,9 +55,9 @@
|
||||
*
|
||||
*
|
||||
* @example
|
||||
<example module="ngAnimate" deps="angular-animate.js" animations="true">
|
||||
<example module="switchExample" deps="angular-animate.js" animations="true">
|
||||
<file name="index.html">
|
||||
<div ng-controller="Ctrl">
|
||||
<div ng-controller="ExampleController">
|
||||
<select ng-model="selection" ng-options="item for item in items">
|
||||
</select>
|
||||
<tt>selection={{selection}}</tt>
|
||||
@@ -71,10 +71,11 @@
|
||||
</div>
|
||||
</file>
|
||||
<file name="script.js">
|
||||
function Ctrl($scope) {
|
||||
$scope.items = ['settings', 'home', 'other'];
|
||||
$scope.selection = $scope.items[0];
|
||||
}
|
||||
angular.module('switchExample', ['ngAnimate'])
|
||||
.controller('ExampleController', ['$scope', function($scope) {
|
||||
$scope.items = ['settings', 'home', 'other'];
|
||||
$scope.selection = $scope.items[0];
|
||||
}]);
|
||||
</file>
|
||||
<file name="animations.css">
|
||||
.animate-switch-container {
|
||||
|
||||
Reference in New Issue
Block a user