我的div面板在ng-click上无法正常工作

时间:2018-11-09 20:33:43

标签: angularjs

我不知道我的代码有什么问题,并且控制台中没有任何错误。我的div面板无法正常工作。我正在单击ng,单击时显示div。此外,右上角的箭头符号也不起作用。

有什么我想念的吗

HTML

<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingOne">
            <h4 class="panel-title"> <a data-toggle="collapse"  style="cursor:pointer" ng-click="ShowDefinition()"  aria-expanded="true" aria-controls="collapseOne">Definition</a> </h4>
        </div>
        <div id="collapseOne" ng-show="IsDefinitionVisible"  class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
            <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingTwo">
            <h4 class="panel-title"> <a class="collapsed" data-toggle="collapse" style="cursor:pointer" ng-click="ShowValues()" aria-expanded="false" aria-controls="collapseTwo"> What We Do? </a> </h4>
        </div>
        <div id="collapseTwo" ng-show="IsValuesVisible" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
            <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. </div>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingThree">
            <h4 class="panel-title"> <a class="collapsed" data-toggle="collapse" style="cursor:pointer" ng-click="ShowPrinciples()" aria-expanded="false" aria-controls="collapseThree"> Where We Do It?  </a> </h4>
        </div>
        <div id="collapseThree" ng-show="IsPrinciplesVisible" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
            <div class="panel-body"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. </div>
        </div>
    </div>


</div>

角度控制器

(function () {

    var app = angular.module('myApp');

    app.controller('aboutController', ['$scope',
      function ($scope) {
          $scope.TestAbout = "Test";


          $scope.ShowDefinition = function () {
              //If DIV is visible it will be hidden and vice versa.
              $scope.IsDefinitionVisible = $scope.IsDefinitionVisible ? false : true;
          }

          $scope.ShowValues = function () {
              //If DIV is visible it will be hidden and vice versa.
              $scope.IsValuesVisible = $scope.IsValuesVisible ? false : true;
          }

          $scope.ShowPrinciples = function () {
              //If DIV is visible it will be hidden and vice versa.
              $scope.IsPrinciplesVisible = $scope.IsPrinciplesVisible ? false : true;
          }

          console.log($scope.TestAbout);
      }
    ]);
})();

1 个答案:

答案 0 :(得分:0)

在这里,工作代码:

HTML:

server {
server_name xx.xx.xx;
listen 443 ssl http2;

ssl_certificate /etc/letsencrypt/live/xx/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xx/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/xx/fullchain.pem;
include /etc/nginx/snippets/ssl.conf;

root "/var/www/html/xx/current/public";
index index.php index.html;
location / { 
     try_files $uri $uri/ /index.php?$query_string;
}
location  /insurance-travel{
             alias /var/www/html/landing-travel;
             index index.php;
             if (!-e $request_filename) { rewrite   /insurance-travel/index.php last; }
             location ~ \.php$ {
                if (!-f $request_filename) { return 404; }
                fastcgi_pass unix:/run/php/php7.1-fpm.sock;

                include /etc/nginx/fastcgi_params;
                fastcgi_param  SCRIPT_FILENAME $request_filename;
          }

    }
sendfile off;

    client_max_body_size 100m;

    location ~ \.php$ {
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
           fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
           fastcgi_index index.php;
           include fastcgi_params;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_intercept_errors off;
           fastcgi_buffer_size 16k;
           fastcgi_buffers 4 16k;
           fastcgi_connect_timeout 300;
       fastcgi_send_timeout 300;
               fastcgi_read_timeout 300;
    }

 }

柱塞:http://plnkr.co/edit/CsMKy6ctHAgXg9O4gkob?p=preview

我还添加了引导箭头。