Skip to content

Instantly share code, notes, and snippets.

@gajus
Created September 26, 2014 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gajus/efe14920c52c07d8a8ba to your computer and use it in GitHub Desktop.
Save gajus/efe14920c52c07d8a8ba to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html ng-app="mainApp">
<head>
<title>Store</title>
<script src="./static/js/angular.js"></script>
<script>
angular
// Injecting customFilterApp to the mainApp, making the components (such as filters and controllers) of the customFilterApp available in the mainApp $scope.
.module('mainApp', ['customFilterApp'])
.controller('mainController', function ($scope) {
$scope.data = {
items: [{name: 'a'}, {name: 'b'}, {name: 'c'}]
};
});
angular
.module('customFilterApp', [])
.filter('myFilter', function () {
return function (data) {
return data;
};
});
</script>
</head>
<body ng-controller="mainController">
<ul>
<li ng-repeat="item in items | myFilter">{{item.name}}</li>
</ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment