In my angular.js tutorial project, I want to hide one div and show another when I click the button. In this code, I would like the first div to be hidden on click (or even destroyed?) And the second div to be shown. Basically, I want the user interface to go from page 1 to page 2 in my application. How to do it?
Index.html
<ion-content ng-controller="StartpageCtrl">
<div class="list card" id="startCard" ng-show="showstartCard">
<div class="item item-image item item-text-wrap">
Card 1
</div>
</div>
<div class="list card" id="secondCard" ng-show="showsecondCard">
<div class="item item-image item item-text-wrap">
Card 2
</div>
</div>
<button ng-click="hideCard()" class="button button-full button-calm button icon-right ion-chevron-right">
Start now
</button>
</ion-content>
controllers.js
.controller("StartpageCtrl", funcion($scope){
$scope.showstartCard = true;
$scope.showsecondCard = false;
$scope.hideCard = function() {
$scope.showstartCard = false;
$scope.showsecondCard = true;
};
});
When I start the page, I see "Map 2" and nothing happens when I click the button. What I wanted to see was "Card 1" and for this go to "Card 2" when I press the button ...
UPDATE SEP 10 23:30 CET
Now it works fine. I forgot to add links to controllers.js in app.js angular.module, as well as a script tag in index.html.