myApp.controller( 'demoDynamicUpdate' , [ '$scope' , function ($scope) {
// This will be our input model
$scope.dynamicData = [];
// Just a function to switch the model
$scope.switchSource = function( data ) {
$scope.dynamicData = angular.copy( $scope[ data ] );
}
// Modern browsers
$scope.modernBrowsers = [
{
icon: '
',
name: 'Opera',
maker: 'Opera Software',
ticked: true
},
{
icon: '
',
name: 'Internet Explorer',
maker: 'Microsoft',
ticked: false
},
{
icon: '
',
name: 'Firefox',
maker: 'Mozilla Foundation',
ticked: true
},
{
icon: '
',
name: 'Safari',
maker: 'Apple',
ticked: false
},
{
icon: '
',
name: 'Chrome',
maker: 'Google',
ticked: true
}
];
// Old browsers
$scope.oldBrowsers = [
{
icon: '
',
name: 'Netscape Navigator',
maker: 'Netscape Corporation',
ticked: true
},
{
icon: '
',
name: 'Amaya',
maker: 'Inria & W3C',
ticked: true
},
{
icon: '
',
name: 'WorldWideWeb Nexus',
maker: 'Tim Berners-Lee',
ticked: false
}
];
// Initially we'll use the modern browsers
$scope.switchSource( 'modernBrowsers' );
}]);