Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('directives').directive('yourDirective', [function() {
- return {
- templateUrl: function($element, $attrs) {
- // Default template path.
- var templateUrl = 'partials/default.html';
- // Check if a template url attribute has been passed in to the
- // directive. If one has been provided then make use of this
- // rather than the default.
- if ($attrs.templateUrl !== undefined) {
- templateUrl = $attrs.templateUrl;
- }
- return templateUrl;
- }
- };
- }]);
- // Example usage: <div data-your-directive data-template-url="'partials/other.html'"></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement