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

Request for an example for options for select field from a remote API through a service #271

Closed
ampsarfraz opened this issue Nov 21, 2016 · 2 comments

Comments

@ampsarfraz
Copy link

I'm submitting a support request.

The request is for an example to fetch options for a select field from a remote API through a service.

Below is an option that I tried, however I couldn't get it to work.
I tried extending the FormlyFieldSelect but I am not able to inject a service into the constructor of the child class. The service always comes up as undefined.

import { NgModule, Component, OnInit} from '@angular/core';
import { EntityrecordApi } from '../sdk/services/custom';
import { Injectable, Inject } from '@angular/core';
import { FormlyFieldSelect } from 'ng2-formly';

@Component({
  selector: 'formly-field-lookup-select',
  providers: [EntityrecordApi],
  template:'<div>Test</div>'
})

export class LookupSelect extends FormlyFieldSelect implements OnInit{
  constructor(private _EntityrecordApi: EntityrecordApi) {
   super()
  }
  ngOnInit(): void {
   //Do Something here
    this._EntityrecordApi.find()
  }
}

image

@mohammedzamakhan
Copy link
Contributor

Can you make a simple plnkr so that we can make that work?

@mohammedzamakhan
Copy link
Contributor

Could this pull request be of any help to you? #286

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

No branches or pull requests

2 participants