angular7

Mat-tree create a tree with values to display and ids

浪子不回头ぞ 提交于 2020-05-13 14:18:23
问题 I'm learning how to use mat-tree following the docs, but now I need to use a data source tree that has not only strings defined in it, because when I click a node I need to know its id. This is the stackblitz of my project. Basically I need to use this tree with checkboxes that I've built following the docs, but now my data source is this: const TREE_DATA:TodoItemNode = { item: "First item", children: [{ item: 'Second item', children:[ { item: "Third item", id: 3 } ], id:2 }], id:1 } So I

Mat-tree create a tree with values to display and ids

让人想犯罪 __ 提交于 2020-05-13 14:14:50
问题 I'm learning how to use mat-tree following the docs, but now I need to use a data source tree that has not only strings defined in it, because when I click a node I need to know its id. This is the stackblitz of my project. Basically I need to use this tree with checkboxes that I've built following the docs, but now my data source is this: const TREE_DATA:TodoItemNode = { item: "First item", children: [{ item: 'Second item', children:[ { item: "Third item", id: 3 } ], id:2 }], id:1 } So I

Mat-tree create a tree with values to display and ids

非 Y 不嫁゛ 提交于 2020-05-13 14:14:09
问题 I'm learning how to use mat-tree following the docs, but now I need to use a data source tree that has not only strings defined in it, because when I click a node I need to know its id. This is the stackblitz of my project. Basically I need to use this tree with checkboxes that I've built following the docs, but now my data source is this: const TREE_DATA:TodoItemNode = { item: "First item", children: [{ item: 'Second item', children:[ { item: "Third item", id: 3 } ], id:2 }], id:1 } So I

Mat-tree create a tree with values to display and ids

断了今生、忘了曾经 提交于 2020-05-13 14:14:00
问题 I'm learning how to use mat-tree following the docs, but now I need to use a data source tree that has not only strings defined in it, because when I click a node I need to know its id. This is the stackblitz of my project. Basically I need to use this tree with checkboxes that I've built following the docs, but now my data source is this: const TREE_DATA:TodoItemNode = { item: "First item", children: [{ item: 'Second item', children:[ { item: "Third item", id: 3 } ], id:2 }], id:1 } So I

dynamic image path not showing in [style.background-image] property in Angular 7

你离开我真会死。 提交于 2020-05-13 07:34:52
问题 I am trying to use dynamic image path as background image in one of my Angular6 project. I have tried using [style.background-image] & [style.background] even encodeURI to fix spaces in path also tried using *ngIF so that it renders after getting loaded. Case 1: imgPath is the absolute path, to which I am appending the path from JSON data. HTML code <a routerLink="/article/{{news.id}}"> <img [style.background-image]="'url(' + imgPath + news.encodedImage.encocoded_primary_image + ')'"> </a>

Typescript 3 Angular 7 StopPropagation and PreventDefault not working

纵然是瞬间 提交于 2020-05-11 03:55:45
问题 I have a text input inside a div. Clicking on the input should set it to focus and stop the bubbling of the div click event. I've tried the stopPropagation and preventDefault on the text input event but to no avail. The console logs shows that the div click still executes regardless. How to stop the div click event from executing? // html <div (click)="divClick()" > <mat-card mat-ripple> <mat-card-header> <mat-card-title> <div style="width: 100px"> <input #inputBox matInput (mousedown)=

Typescript 3 Angular 7 StopPropagation and PreventDefault not working

对着背影说爱祢 提交于 2020-05-11 03:55:30
问题 I have a text input inside a div. Clicking on the input should set it to focus and stop the bubbling of the div click event. I've tried the stopPropagation and preventDefault on the text input event but to no avail. The console logs shows that the div click still executes regardless. How to stop the div click event from executing? // html <div (click)="divClick()" > <mat-card mat-ripple> <mat-card-header> <mat-card-title> <div style="width: 100px"> <input #inputBox matInput (mousedown)=

cdkDropList with ng-template on dynamic component list do'snt work

帅比萌擦擦* 提交于 2020-04-30 16:04:00
问题 I'm trying to use Drag&Drop features released with Angular Material 7. And dynamically creating component using ng-tempalte. <div cdkDropList (cdkDropListDropped)="dropLocal($event)"> <ng-template #components></ng-template> </div> and added cdkDrag at components. I am using createComponent at parent component to keep on create components. viewContainerRef.createComponent but dragdrop functionality is not functional since cdkDrag must be in a tag nested inside the one with cdkDropList,

cdkDropList with ng-template on dynamic component list do'snt work

自古美人都是妖i 提交于 2020-04-30 16:03:56
问题 I'm trying to use Drag&Drop features released with Angular Material 7. And dynamically creating component using ng-tempalte. <div cdkDropList (cdkDropListDropped)="dropLocal($event)"> <ng-template #components></ng-template> </div> and added cdkDrag at components. I am using createComponent at parent component to keep on create components. viewContainerRef.createComponent but dragdrop functionality is not functional since cdkDrag must be in a tag nested inside the one with cdkDropList,

cdkDropList with ng-template on dynamic component list do'snt work

不打扰是莪最后的温柔 提交于 2020-04-30 16:02:18
问题 I'm trying to use Drag&Drop features released with Angular Material 7. And dynamically creating component using ng-tempalte. <div cdkDropList (cdkDropListDropped)="dropLocal($event)"> <ng-template #components></ng-template> </div> and added cdkDrag at components. I am using createComponent at parent component to keep on create components. viewContainerRef.createComponent but dragdrop functionality is not functional since cdkDrag must be in a tag nested inside the one with cdkDropList,