mercredi 20 janvier 2016

How to make chckbox list based on checkbox check and uncheck using angularjs?

I have object which contains mobile brand with models.i have included my object here angular.module('myApp', []) .controller("myCntrl", function ($scope) {

$scope.items= [{


    id: "986745",
    brandname: "Nokia",
    modelname: "Lumia 735 TS"

}, {

    id: "896785",
    brandname: "Nokia",
    modelname: "Nokia Asha 230"
}, {

    id: "546785",
    brandname: "Nokia",
    modelname: "Lumia 510"
},
{

    id: "144745",
    brandname: "Samsung",
    modelname: "Galaxy Trend 840"
},

{

    id: "986980",
    brandname: "Samsung",
    modelname: "Galaxy A5"
},
{

    id: "586980",
    brandname: "Samsung",
    modelname: "Galaxy Note 4 Duos"
},
{

    id: "986980",
    brandname: "Samsung",
    modelname: "Galaxy A5"
},
{

    id: "586980",
    brandname: "Samsung",
    modelname: "Galaxy Note Duos"
},

{

    id: "232980",
    brandname: "Htc",
    modelname: "Htc One X9"
},
{

    id: "456798",
    brandname: "Htc",
    modelname: "Desire 820"
},
{

    id: "656798",
    brandname: "Htc",
    modelname: "Desire 810S"
}

]

})

My Expectation: here i am having 3 mobile brands with respective models.when i come to this page it should show 3 checkboxes (below i given) 1.Nokia 2.Samsung 3.Htc

if i click nokia then it should show Nokia mobile models with checkboxs like (list with checkbox) 1.Lumia 735 TS 2.Nokia Asha 230 3.Lumia 510 if i click Samsung or Htc then it should show respective models like nokia

when i submit i should get only checked checkbox values both brandname and modelname any one help me out

Aucun commentaire:

Enregistrer un commentaire