Ionic Creator

Toggling Content

Want to use a Button Bar to switch between different sets of content? Or perhaps use an actual Toggle to show or hide a piece of content? We've got your back! 💪

 

Here's the final code from the end of the video:

// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {

    $scope.activeSection = 2;
    
    $scope.changeSection = function(s){
        $scope.activeSection = s;
    }

}
// The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {

    $scope.showContent = false;

}

Toggling Content