3

ブール値を変更してng-clickdivを表示するためのナビゲーションバーがあります。クリックするとブール値が変化しますが、ng-show反応しません。

このhtmlはレイアウトファイルにあり、使用しているコントローラーはボディhtmlファイルにあります。上記の html を body html ファイルに入れると、すべて正常に動作しますか? 何が起こっているのでしょうか?angularまたは他の場所からエラーは発生しません。スクリプト インクルードはすべて、レイアウト ファイルと角度のあるアプリ定義に含まれています。

レイアウト ファイルの navbar からの HTML:

<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:

<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>

本文 cshtml ファイルの下部にある JavaScript。

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);
};
4

0 に答える 0