mardi 28 novembre 2017

Dynamically change container when clicking radiobutton

I would like to change dynamically container after clicking on a radiobutton. I know I can do it easily using a ng-model and value. Here is a JSFiddle: http://ift.tt/2k6XLP2 It works fine when you have a small container or just some text. But how can I do that with a huge container stored in a scope ?

function MyCtrl($scope) {
    $scope.value[0]='<div>big container when clicking radiobutton 1</div>'
    $scope.value[1]='<div>big container when clicking radiobutton 2</div>'
    $scope.value[2]='<div>big container when clicking radiobutton 3</div>'
}

$scope.value[0] got the container of my radiobutton 1, $scope.value[1] got the container of my radiobutton 2 and $scope.value[2] got the container of my radiobutton 3.

What should the HTML be to do that dynamically ? (By 'dynamically' I mean clicking on a radiobutton changes the container as the example shown in the jsfiddle.)

Thank you a lot !




Aucun commentaire:

Enregistrer un commentaire