Created
September 26, 2014 12:19
-
-
Save gajus/1cc47bb3f4717eb2ee90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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