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

Skip to content

Commit b9faec0

Browse files
committed
docs(formDirective): update example to use a module
1 parent e1f3c0c commit b9faec0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/ng/directive/form.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,13 @@ function FormController(element, attrs, $scope, $animate) {
352352
* </pre>
353353
*
354354
* @example
355-
<example deps="angular-animate.js" animations="true" fixBase="true">
355+
<example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
356356
<file name="index.html">
357357
<script>
358-
function Ctrl($scope) {
359-
$scope.userType = 'guest';
360-
}
358+
angular.module('formExample', [])
359+
.controller('FormController', ['$scope', function($scope) {
360+
$scope.userType = 'guest';
361+
}]);
361362
</script>
362363
<style>
363364
.my-form {
@@ -369,7 +370,7 @@ function FormController(element, attrs, $scope, $animate) {
369370
background: red;
370371
}
371372
</style>
372-
<form name="myForm" ng-controller="Ctrl" class="my-form">
373+
<form name="myForm" ng-controller="FormController" class="my-form">
373374
userType: <input name="input" ng-model="userType" required>
374375
<span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
375376
<tt>userType = {{userType}}</tt><br>

0 commit comments

Comments
 (0)