Tink
Tink

Reputation: 132

Dynamic change of tag value in formly

How can I dynamically change value of tag (i.e. id and name)? Here I am providing static value for tag but I want to change it dynamically. My code is :

    $scope.formFields = [ {
                    className : 'row',
                    fieldGroup : [
                            {
                                className : 'col-xs-12',
                                type : 'tag',
                                key : 'mytag',

                                templateOptions : {
                                    placeholder : 'Select...',


                                }
                            } ]
                } ];

$scope.myForm = {
                mytag:[{"id":"1","name":"data"}]            

                };

Upvotes: 0

Views: 403

Answers (1)

Nirmal Borkar
Nirmal Borkar

Reputation: 126

You can write a function to send the values, then using these values to set it dynamically

$scope.myForm = {mytag : [{"id":"1","name":"data"}]};

$scope.setValues(value1,value2);

$scope.setValues = function(value1,value2){

 $scope.myForm.mytag[0].id = value1;
 $scope.myForm.mytag[0].name = value2;

};

Upvotes: 2

Related Questions