Skip to content

Commit f9a5d48

Browse files
jvans1RichardLitt
authored andcommitted
docs($filter): add runnable example
Closes angular#6871
1 parent bb8f627 commit f9a5d48

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/ng/filter.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,24 @@
7373
*
7474
* @param {String} name Name of the filter function to retrieve
7575
* @return {Function} the filter function
76-
*/
76+
* @example
77+
<example name="$filter" module="filterExample">
78+
<file name="index.html">
79+
<div ng-controller="MainCtrl">
80+
<h3>{{ originalText }}</h3>
81+
<h3>{{ filteredText }}</h3>
82+
</div>
83+
</file>
84+
85+
<file name="script.js">
86+
angular.module('filterExample', [])
87+
.controller('MainCtrl', function($scope, $filter) {
88+
$scope.originalText = 'hello';
89+
$scope.filteredText = $filter('uppercase')($scope.originalText);
90+
});
91+
</file>
92+
</example>
93+
*/
7794
$FilterProvider.$inject = ['$provide'];
7895
function $FilterProvider($provide) {
7996
var suffix = 'Filter';

0 commit comments

Comments
 (0)