Skip to content

Using angular-material and formly #25

Open
@gussoler

Description

@gussoler

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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions