【问题标题】:RAML api-console is not loading the api.raml fileRAML api-console 未加载 api.raml 文件
【发布时间】:2016-10-07 12:12:12
【问题描述】:

我正在尝试让 RAML api-console 像这样工作:

<html>
  <head>
    <link rel="stylesheet" href="styles/api-console-light-theme.css" type="text/css"/>
  </head>
  <body ng-app="ramlConsoleApp" ng-cloak>
    <script type="text/javascript" src="scripts/api-console-vendor.js"></script>
    <script type="text/javascript" src="api-console.js"></script>

    <div style="overflow:auto;position:relative;">
      <raml-console src="api.raml"></raml-console>
    </div>

  </body>
</html>    

似乎src="api.raml" 部分没有做任何事情。

所有其他部分工作正常。例如,添加属性disable-theme-switcher 会从页面中移除“切换主题”按钮。

控制台中没有错误,Chrome 开发者工具中的“网络”标签没有显示下载失败。所以看起来应用程序甚至没有尝试加载文件。

【问题讨论】:

    标签: api angularjs-directive raml


    【解决方案1】:

    尝试使用&lt;raml-console-loader src="api.raml"&gt;&lt;/raml-console-loader&gt; 而不是&lt;raml-console src="api.raml"&gt;&lt;/raml-console&gt;。请注意,在 raml-1.0 分支的当前状态下,其他指令(例如 disable-theme-switcher)在此新标签中不起作用。可以看到相关问题#278#284286

    【讨论】:

    • 谢谢。这也适用于 raml 0.8 吗?我使用的是 0.8,因为 abao 似乎还不支持 1.0。
    • @HendrikJan 我没有用 0.8 进行测试。事实上,1.0 在一个单独的分支名称 raml-1.0 中得到了相当长的一段时间的支持。但是,似乎该分支现在已合并到 master 中。请尝试下载最新的 master 分支。
    猜你喜欢
    • 2015-01-25
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 2018-09-02
    • 1970-01-01
    • 2016-07-08
    • 1970-01-01
    • 2018-03-17
    相关资源
    最近更新 更多