Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request, object.property binding in TdChips #644

Closed
zyarnold opened this issue May 30, 2017 · 5 comments
Closed

Feature Request, object.property binding in TdChips #644

zyarnold opened this issue May 30, 2017 · 5 comments

Comments

@zyarnold
Copy link

//..component.ts
this.heroes= [
  { id:1, name:"Groot"  },
  { id:21, name:"StarLord" }
];
//..component.html
<td-chips [(ngModel)]="favoriteHeroID" [items]="heroes" [chipValue]="'item.id'" [chipTitle]="'item.name'"  ></td-chips>

chipValue and chipTitle should default to 'item' if not specified

@emoralesb05
Copy link
Contributor

emoralesb05 commented May 30, 2017

Already merged object support #626 and will be available in beta.5.

@emoralesb05
Copy link
Contributor

Usage

<td-chips [items]="objects"
          [(ngModel)]="objectsModel"
          requireMatch>
  <ng-template td-basic-chip let-chip="chip">
    {{chip.city}}, (Pop: {{chip.population}})
  </ng-template>
  <ng-template td-autocomplete-option let-option="option">
    <md-icon>location_city</md-icon> {{option.city}}
  </ng-template>
</td-chips>

@zyarnold
Copy link
Author

<td-chips [items]="objects"
[(ngModel)]="objectsModel"
requireMatch>

{{chip.city}}, (Pop: {{chip.population}})


location_city {{option.city}}

so how do I command the chip to bind ngmodel on the .city while displaying .population as a display string?

@emoralesb05
Copy link
Contributor

emoralesb05 commented May 30, 2017

let-chip="chip" and let-option="option" in the template micro syntax

and chip / option will have the properties you need to access.

Once we release this there will be demos to help out and examples

@zyarnold
Copy link
Author

ok thanks...please close issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants