简体   繁体   English

组件正在路由器出口外加载

[英]component is loading outside router-outlet

app.component.html应用程序组件.html

<div class="row">
   <app-aside class="col-lg-3 col-md-12 px-2"></app-aside>
   <router-outlet class="col-lg-9 col-md-12 px-2"></router-outlet> 
</div>

outoput产量

<app-aside class="col-lg-3 col-md-12 px-2"></app-aside>
<router-outlet class="col-lg-9 col-md-12 px-2"></router-outlet> 
<app-dashboard></app-dashboard>

i am trying to load component inside router-outlet.我正在尝试在路由器插座内加载组件。 but its not happening.但它没有发生。 New in angular so have less knowledge about deep level difficulties.角度方面的新手,因此对深层困难的了解较少。

Angular use this html, It should look like this: Angular 使用这个 html,它应该是这样的:

<router-outlet></router-outlet> 

You need to remove the class and not use this as an html element, what you can do with it specified here .您需要删除该类,而不是将其用作 html 元素,您可以在此处指定如何使用它。

More about this you can read in this question .您可以在此问题中阅读有关此内容的更多信息。

hey try this,嘿试试这个

   <div class="row">
      <div class="col-lg-3 col-md-12 px-2">
        <app-aside></app-aside>
      </div>
      <div class="col-lg-9 col-md-12 px-2">
        <router-outlet></router-outlet>
      </div>
   </div>

Make sure that you have responsive content for the router-outlet.确保您有路由器插座的响应内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM