angularcli填坑系列(持续更新...)

1.在xx.ts中引入css样式无效

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
解决:去除 styleUrls中的  ./
            styleUrls: ['app.component.css']
 
2. 在引入bootstrap4 时 缺少 popper,js

      解决:.angular-cli.json 文件中scripts节点 ,引入的bootstrap.min.js 更换为 
../node_modules/bootstrap/dist/js/bootstrap.bundle.js
 
 
 
 
 
 
3.局部路由跳转到其他页面,其页面宽度高度是根据内容。要使其根据整体100%
 

   解决:在 其组件中的css 文件中添加样式

使用:host伪类选择器,用来选择组件宿主元素中的元素(相对于组件模板内部的元素)

:host {
100%;
height: 100%;
padding: 0px;
margin: 0px;
}
 
4.引入ngx-echarts,在全部配置完成后,报错!!!
百度N久没法解决, 在GitHub上翻了下Issues,发现

发现可能是包冲突,删除node_modules文件夹,重新npm 后正常

原文地址:https://www.cnblogs.com/zhuzy/p/8031771.html