2017-03-18 6 views
0

私はangle2アプリケーションでswagger-ui(swagger-ui.js)を実装しました。レンダリングされ、リンク(#!users/get_user)をクリックすると、そのdivにスクロールせずにリンクにルーティングされます。angle2のアンカータグを使用した同じページルート

window['swaggerUi'] = new window['SwaggerUi']({ 
       spec: this.swaggerJson, 
       dom_id: "swagger-ui-container", 
       supportedSubmitMethods: ['get', 'post', 'put', 'delete'], 
       useJQuery: true, 
       onComplete: function() { 
        } 
        window['jQuery']('pre code').each(function (i, e) { 
         window['hljs'].highlightBlock(e) 
        }); 
       }, 
       onFailure: function (data) { 
        console.log("Unable to Load SwaggerUI"); 
       }, 
       docExpansion: "none", 
       sorter: "alpha" 
      }); 

hrefを含むリンクはルーティングですが、data-idを含むリンクは正常に動作しています。 どうすればこれらのリンクのルーティングをブロックできますか。

<a href="#!/users/get_users_userid" class="toggleOperation">Users</a> 
<!-- routes to that url(localhost:8080/#!/users/get_users_userid) --> 

<a href="#" class="expandResource" data-id="users">Expand Operations</a> 
<!-- it expands the div --> 

答えて

0

固定しました。私はswagger-ui.jsで変更しました。

クリックしたときにルーティングを引き起こしていた要素のhref = ""に変更しました。

これは回避策ですが、現在は機能しています。 :)