File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -313,21 +313,22 @@ forEach(
313
313
* ({@link guide/expression#-event- Event object is available as `$event`})
314
314
*
315
315
* @example
316
- <example>
316
+ <example module="submitExample" >
317
317
<file name="index.html">
318
318
<script>
319
- function Ctrl($scope) {
320
- $scope.list = [];
321
- $scope.text = 'hello';
322
- $scope.submit = function() {
323
- if ($scope.text) {
324
- $scope.list.push(this.text);
325
- $scope.text = '';
326
- }
327
- };
328
- }
319
+ angular.module('submitExample', [])
320
+ .controller('ExampleController', ['$scope', function($scope) {
321
+ $scope.list = [];
322
+ $scope.text = 'hello';
323
+ $scope.submit = function() {
324
+ if ($scope.text) {
325
+ $scope.list.push(this.text);
326
+ $scope.text = '';
327
+ }
328
+ };
329
+ }]);
329
330
</script>
330
- <form ng-submit="submit()" ng-controller="Ctrl ">
331
+ <form ng-submit="submit()" ng-controller="ExampleController ">
331
332
Enter text and hit enter:
332
333
<input type="text" ng-model="text" name="text" />
333
334
<input type="submit" id="submit" value="Submit" />
You can’t perform that action at this time.
0 commit comments