小编B.V*_*mar的帖子

使用 chart.js 沿总计数堆叠水平条形图

我找不到添加堆叠水平条形图总数的解决方案!

代码笔链接:代码链接 在此处输入图片说明enter code here

javascript chart.js

4
推荐指数
1
解决办法
6053
查看次数

Angular 2与*ngFor和ngIf隐藏第一个元素

在Angular 2中,我得到了一个项目列表,并根据给定的条件(即基于位置编号)我设置列表重复.

我需要为每个位置的第一个框隐藏" 删除文本 ".

Plunker: https://plnkr.co/edit/xtX5BjTBjO61sD2tLwWN p = preview:

实际的img

[1]: https://plnkr.co/edit/xtX5BjTBjO61sD2tLwWN?p=preview
Run Code Online (Sandbox Code Playgroud)

import {Component} from '@angular/core';

@Component({
	selector: 'app',
	template: `
	  
    <ul *ngFor="let locdata of locations">
   
     <template ngFor let-item [ngForOf]="items"; let-i=index>
          <div *ngIf="item.location==locdata.location">
             <div class="title"> location  {{ item.location}} <span  *ngIf="isNotFirst(item)">  remove </span> </div>
          <div class="container"> {{ item.sedule}}</div>
       </div>
      </template>
	  </ul>
	 
	`
})
export class App {
  items: string[];
  
   isNotFirst(item: any) {
      return this.items.filter(i => i.location === item.location).map(i => i.id).indexOf(item.id) !== 0;
    }
  
  locations:any;
  
  constructor() {
    this.locations=[{location:1},{location:2},{location:3}]; …
Run Code Online (Sandbox Code Playgroud)

javascript angular2-directives angular2-template angular

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