Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Error Messages doesn't work inside modal belonging to tile button #38

Open
christophechevalier opened this issue May 23, 2016 · 1 comment

Comments

@christophechevalier
Copy link

Hi guys.

I try to add error messages on my app but the red animation error doesn't work .
Indeed, it work when I make a simple example like : http://jsbin.com/rexuquqeta/edit?js,console,output

  • Basically, I have a page that displays a grid on which I use a ng-repeat .

  • Inside each " tile " I dynamically displays data as text .

  • Each " tile " is a button that opens a modal .

  • When I click on a " tile " , so I open a modal which displays editable data as " input " .

  • Except that my problem is that the error messages do not fontionnent with my current structure .

  • Here is an overview :

        vm.tiles = [
            /* State */
            {
                span: {row: 2, col: 1},
                background: 'yellow',
                title: 'State',
                model: {
                    state: vm.details.state,
                    name: vm.details.name,
                    description: vm.details.description
                },
                fields: [
                    {
                        key: 'state',
                        type: 'detailsCenter',
                        templateOptions: {}
                    },
                    {
                        key: 'name',
                        type: 'details',
                        templateOptions: {
                            label: 'Name : '
                        }
                    },
                    {
                        key: 'description',
                        type: 'details2lines',
                        templateOptions: {
                            label: 'Description : '
                        }
                    }
                ],
                fieldsModal: [
                    {
                        elementAttributes: {
                            layout: 'row',
                            'layout-sm': 'column',
                            'layout-xs': 'column'
                        },
                        fieldGroup: [
                            {
                                key: 'state',
                                type: 'detailsCenter',
                                templateOptions: {}
                            }
                        ]
                    },
                    {
                        elementAttributes: {
                            layout: 'row',
                            'layout-sm': 'column',
                            'layout-xs': 'column'
                        },
                        fieldGroup: [
                            {
                                key: 'name',
                                className: 'flex-xs-100 flex-sm-100 flex-100',
                                type: 'input',
                                templateOptions: {label: 'Name : ', 'required': true}
                            },
                            {
                                key: 'description',
                                className: 'flex-xs-100 flex-sm-100 flex-100',
                                type: 'input',
                                templateOptions: {label: 'Description : ', 'required': true}
                            }
                        ]
                    }
                ]
            }, ...
    

If you have an idea what it could be ?

Nb: if you want more informations, say it to me .. thanks a lot for your help

@christophechevalier
Copy link
Author

christophechevalier commented Jun 3, 2016

Hi, I have a news..

First, I create a constant conf with a generic messages like :

...

var conf = {
    validation: {
        stringMessages: {
            required: 'Required.',
            ipAddress: 'Must be a valid ip address.',
            // generic
            valid: 'Must be a valid value.'
        }
    }
};
configServer.constant('conf', conf);

...

Then, I invoke a iterator function once forEach value in obj
...

    // generic messages
    angular.forEach(conf.validation.stringMessages, function (value, key) {
        formlyValidationMessages.addStringMessage(key, value);
    });

...
So this issue is resolved.
Now, I have a next issue with defaultValue..
defaultValue doesn't work when I change fieldname: field by fieldname: fieldDisplay or other ...

Is that 'field' is unique or I can change his name ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants