Sha256: 632f201144a91082eafe0c8aadc152b27462f474ad136527ef0ac2aecaf1be2d

Contents?: true

Size: 820 Bytes

Versions: 11

Compression:

Stored size: 820 Bytes

Contents

/**
 * This directive replaces itself with a specialised type template based on the
 * type it is displaying.
 */
app.directive('typePlaceholder', function(templateFor, $stateParams) {
  return {
    restrict: 'EA',
    scope: {
      type: '=',
      template: '@',
      details: '=?',
      name: '=?',
      parentRequirements: '=?',
    },
    link: function(scope, element) {

      scope.apiVersion = $stateParams.version;

      if( typeof scope.parentRequirements === 'undefined' ){
        if( typeof scope.type.requirements !== 'undefined' && scope.type.requirements.length > 0 ){
          scope.parentRequirements = scope.type.requirements;
        }
      }

      templateFor(scope.type, scope.template).then(function(templateFn) {
        element.replaceWith(templateFn(scope));
      });
    }
  };
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
praxis-2.0.pre.9 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.8 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.7 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.6 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.5 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.4 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.3 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.2 lib/api_browser/app/js/directives/type_placeholder.js
praxis-2.0.pre.1 lib/api_browser/app/js/directives/type_placeholder.js
praxis-0.22.pre.2 lib/api_browser/app/js/directives/type_placeholder.js
praxis-0.22.pre.1 lib/api_browser/app/js/directives/type_placeholder.js