I have an ng-click
in my navbar to change the boolean and show my div. When I click it, the boolean changes, but the ng-show
doesnt respond.
This html is in my layout file while the controller I'm working with is in my body html file. when i put the above html in my body html file the whole thing works fine? What could be going on? I get no errors from angular or anywhere else. All my script includes are in my layout file as well as my angular app definition.
Html from navbar in layout file:
<div class="navbar-collapse collapse" ng-controller="MoviesCtrl">
<ul class="nav navbar-nav">
<li class="active"><a href="index.html"><i class="icon-home icon-white"></i> Today</a></li>
<li ng-click="flipTwoDay()"><a><i class="icon-folder-open icon-white"></i> Two Days</a></li>
<li><a href="manager.html"><i class="icon-folder-open icon-white"></i> All</a></li>
</ul>
</div>
Html in body file:
<div ng-show="twoDay.show">
<h1>{{tomorrow}}</h1>
<div ng-repeat="theat in data.Locations">
<div class="col-sm-6 col-lg-6">
<div class="dash-unit">
<dtitle>{{theat.Name}}</dtitle>
<hr>
<div ng-repeat="film in theat.Dates[tomorrow]">
{{film.title}}{{film.times}}
</div>
</div>
</div>
</div>
</div>
JavaScript which lives at the bottom of body cshtml file.
mabuse.page.moviesCtrl = function ($scope, $firebase) {
var ref = new Firebase("https://mabuse.firebaseio.com/");
// create an AngularFire reference to the data
var sync = $firebase(ref);
$scope.data = sync.$asObject();
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
if (day < 10) {
dat = '0' + day
}
if (month < 10) {
month = '0' + month
}
$scope.today = day + " " + month + " " + year;
day += 1;
$scope.tomorrow = day + " " + month + " " + year;
$scope.twoDay = {show : false};
$scope.flipTwoDay = function () {
$scope.twoDay.show = true;
// $scope.$digest();
console.log($scope.twoDay.show);
};
console.log($scope.tomorrow);
};