Created
December 18, 2013 00:47
-
-
Save anonymous/8015522 to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<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> |
This file contains hidden or 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
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