meta-magic / amexio.github.io

Amexio is a rich set of Angular 7 (170+) components powered by HTML5 & CSS3 for Responsive Design and with 80+ Material Design Themes, UI Components, Charts, Gauges, Data Point Widgets, Dashboards. Amexio is completely Open Sourced and Free. It's based on Apache 2 License. You can use it in your production grade work today at no cost or no obligation.
http://www.amexio.tech
Apache License 2.0
167 stars 72 forks source link

Is it possible to populate amexio dropdown without using http-url property? #62

Closed abhinavsachdeva2701 closed 6 years ago

abhinavsachdeva2701 commented 6 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ x] Support request

Current behavior

Right now, when I pass REST API Url in the amexio dropdown in http-url property, the dropdown populates with values.

Expected behavior

Is it possible to populate dropdown without using http-url. What i want to do is define the REST API url in Angular Service and then i want to populate the values in dropdown.

Minimal reproduction of the problem with instructions

For bug reports please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via https://plnkr.co or similar (you can use Our Amexio Plunker as a starting point: http://plnkr.co/edit/M9AeGH?p=info)

What is the motivation / use case for changing the behavior?

I don't want to pass any rest url in HTML components.

Environment


Angular version: 4.0.0


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

sagarthecook commented 6 years ago

@abhinavsachdeva2701 You can use data attribute for local data refer Link

baminmru commented 6 years ago

--- html ---

<amexio-dropdown [field-label]="'Only one answer'" name ="onlyOneAnswer" [(ngModel)]="onlyOneAnswer" [display-field]="'name'" [value-field]="'id'" [data]="enumTriStateCombo()"

--- typescript ---

export class ComboInfo{ id:string; name:string; }

/ YesNo - No / Yes -> (0 / 1) / public enumYesNoCombo(){ return this.enumYesNo; } enumYesNo:Array =[

{id:'1',name:'Yes'} , {id:'0',name:'No'} ];

DatsGawas commented 6 years ago

Hi @baminmru [data] attribute takes input as Array or Object. your code should be like this <amexio-dropdown [field-label]="'Only one answer'" name ="onlyOneAnswer" [(ngModel)]="onlyOneAnswer" [display-field]="'name'" [value-field]="'id'" [data]="enumYesNo"

baminmru commented 6 years ago

[data]="enumYesNo()"

enumYesNo is function returning array, not property

abhinavsachdeva2701 commented 6 years ago

Thanks Team, I was able to get it working !!