docs(formDirective): update example to use a module

This commit is contained in:
Brian Ford
2014-07-07 14:16:47 -07:00
parent dd18c00b1d
commit a5b6444324

View File

@@ -314,12 +314,13 @@ function FormController(element, attrs, $scope, $animate) {
* </pre>
*
* @example
<example deps="angular-animate.js" animations="true" fixBase="true">
<example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
<file name="index.html">
<script>
function Ctrl($scope) {
$scope.userType = 'guest';
}
angular.module('formExample', [])
.controller('FormController', ['$scope', function($scope) {
$scope.userType = 'guest';
}]);
</script>
<style>
.my-form {
@@ -331,7 +332,7 @@ function FormController(element, attrs, $scope, $animate) {
background: red;
}
</style>
<form name="myForm" ng-controller="Ctrl" class="my-form">
<form name="myForm" ng-controller="FormController" class="my-form">
userType: <input name="input" ng-model="userType" required>
<span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
<tt>userType = {{userType}}</tt><br>