小编use*_*572的帖子

如何在表格标题内垂直居中对齐图标

我有一个动态表,具有动态的列和行数...在表标题中,我需要修复排序图标垂直居中...即使表标题文本大小是动态的,并且行数不断增长...如何垂直对齐排序图标而文本大小不断增加?

jsfiddle

<table style="width:100%">
  <tr>
    <th><div class='filter-container header-container'> <div class='header-text'>  Firstname Firstname Firstnam eFirstnam eFirstname Firstname Firstname Firstname Firstname</div><div class='icon-right'> <span    class= "fa fa-sort-asc fa-lg sort-icon "></span><span   class= "fa fa-sort-desc fa-lg sort-icon  "></span></div></div></th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
  <tr>
    <td>Jill</td>
    <td>Smith</td>
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td>
    <td>94</td>
  </tr>
  <tr>
    <td>John</td>
    <td>Doe</td>
    <td>80</td>
  </tr>
</table>
Run Code Online (Sandbox Code Playgroud)

CSS:

table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}

th, td {
  padding: 5px;
}

.filter-container {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 0px …
Run Code Online (Sandbox Code Playgroud)

html css

7
推荐指数
1
解决办法
1万
查看次数

浏览器加载 index.html 的缓存版本 - angular 7

我有一个在 python 服务器上运行的 angular 7 应用程序,我们正在使用 angular-cli 构建项目文件。在构建时,我正在使用以下命令设置缓存突发选项。

ng build --prod --build-optimizer --aot --output-hashing=all

output-hashing=all 将根据角度文档处理缓存突发。虽然我提供了这个标志,但在部署我们的应用程序文件名后附加了哈希值(styles.a5169d3732258e921e2c.css、main.8dc0644c88c4fbf67797.js)但 index.html 文件总是显示缓存版本。

我想在客户端缓存除 index.html 之外的所有文件。我将如何做到这一点?

browser-cache angular-cli angular7

6
推荐指数
1
解决办法
7199
查看次数

哪个是保持逻辑角度的最佳位置?

我正在开发一个角度应用程序。假设当我们实现某个按钮的 onclick 等功能时,调用 api,处理数据,在表中显示结果。表数据应该跨页面保留(因此我们需要保持变量处于服务状态)。

为了实现,首先我们可以开始从模板调用函数,然后在组件中我们可以做一些检查,并调用服务来获取数据。一旦我们得到了数据,如果我们想要处理数据,那么处理数据的函数应该在组件或服务中?

我们可以在服务文件中编写逻辑吗?或者它应该在组件文件中?最佳做法是什么?

方法一:

 getApi() {
    this.http
      .get(url)
      .subscribe(response=> {
          this.afterFetchingProcessData(response); // this might be some function in service file
      },error=>{
          // handle error
      });
  }

  afterFetchingProcessData(response){
       //process the data and assign to variable 
       this.tabledata = response;
  }
Run Code Online (Sandbox Code Playgroud)

或者我们应该遵循以下模式

方法2:在组件文件中:

 getApi() {
      this.service.getApi().subscribe(response=> {
          this.afterFetchingProcessData(response); // this might be some function in service file
      },error=>{
          // handle error
      });
  }

  afterFetchingProcessData(response){
       //process the data and assign to variable 
       this.service.tabledata = response;
  }
Run Code Online (Sandbox Code Playgroud)

在服务文件中只需调用 Api 并返回响应

 getApi() { …
Run Code Online (Sandbox Code Playgroud)

angular

6
推荐指数
2
解决办法
1万
查看次数

如何在另一个角度应用程序中加载角度应用程序

我有两个角度应用程序 A 和 B。现在在 B 应用程序的 One 选项卡中我想加载整个应用程序 A。我该如何实现这一目标?

请让我知道如何实现此功能。Angular 是否有任何我可以使用的特殊标签

web typescript angular

6
推荐指数
2
解决办法
6156
查看次数

标签 统计

angular ×2

angular-cli ×1

angular7 ×1

browser-cache ×1

css ×1

html ×1

typescript ×1

web ×1