jeudi 14 avril 2016

angularjs - checkbox status controlling from remote data

Im trying to make a notification configuration page. Basically the user should be able to choose what kind of notifications he wishes to receive for a specific module. There are 3 types of notifications (Email, SMS and UI). Currently my array is build like this

$scope.modules= [
        {
            "id": 1,
            "name": "Module1",
            "notifications": [
                {
                    "notification": "email"
                }
            ]
        },
        {
            "id": 2,
            "name": "Module2",
            "notifications": [
                {
                    "notification": "sms"
                },
                {
                    "notification": "ui"
                }
            ]
        }
    ];

I'm trying to achieve this view

enter image description here

The problem: When I am trying to repeat notifications of a certain module, if for example {"notification": "email"} doest not exist, the checkbox does not stay unchecked, but instead is removed from the view.

Any ideas how to perform the ng-repeat? Thanks




Aucun commentaire:

Enregistrer un commentaire