Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2013 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/8015522 to your computer and use it in GitHub Desktop.
Save anonymous/8015522 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body ng-app="test" ng-controller="PageController">
{{message}}
<div ng-repeat="filter in filters" filter="filter"></div>
</body>
</html>
var module = angular.module('test', []);
module.directive('filter', function() {
return {
scope: {filter: '=filter'},
template: '<div ng-include="filter.url"></div>'
};
});
function PageController($scope, $templateCache) {
$scope.message = 'hello';
$templateCache.put('range.html',
'<p><input ng-model="filter.min"><input ng-model="filter.max"></p>');
$templateCache.put('text.html',
'<p><input ng-model="filter.text"></p>');
$scope.filters = [
{url: 'range.html', min: 0, max: 100},
{url: 'text.html', text: 'World'}
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment