formly-js / formly-js/angular-formly-website

Using angular-material and formly

Open
#25 3 comments 0 reactions 0 assignees View on GitHub
example request help wanted
Dominant language
JavaScript
Stars
18
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I have a controller that loads the formFields from a Json file (JSON powered form):

api.getModelForm().then(function(response) {
vm.fields = response.data;
vm.originalFields = angular.copy(vm.fields);
});

It generates the form as expected.

Now I would like to extend the type 'select' using as template:

'<md-select placeholder="State" ng-model="model[options.key]"><md-option ng-repeat="state in vm.states" value="{{state.abbrev}}">{{state.abbrev}}</md-option></md-select>'

And works fine, the type 'select' is using the new template defined. But here comes the problem: the directive is working but vm.states (map defined at controller) isn't found. I think when formly is used the controller's $scope can't be accessed from a directive, it is true?
How can I make it work?

I have seen the example "async-select-options-with-controller" I am also using "angular-formly-templates-material.js" but I would like to extend the templates and start using angular-material in conjunction with Formy.

Thanks in advance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.