zoukankan      html  css  js  c++  java
  • angular1 自定义手风琴写法

    <body ng-app="myApp" class="body">


    <div ng-controller="AccordionDemoCtrl">
    <div ng-repeat="info in panelShow">
    <h2 ng-click="openCon($index)">{{info.title}}</h2>
    <!--ng-class="{'active':info.status}"-->
    <section class="con" ng-if="info.status">{{info.infoBox}}</section>
    </div>

    </div>

    </body>


    <script> var App = angular.module('myApp', []); App.controller('AccordionDemoCtrl', function ($scope) { $scope.panelStatus = false; var mySomething = [ { title:'UI设计', infoBox:'至少你要会画画吧' }, { title:'web程序员', infoBox:'至少你要会写代码吧' }, { title:'产品狗狗', infoBox:'至少你要会思考吧' } ]; $scope.panelShow = mySomething; angular.forEach($scope.panelShow,function(i){ i.status = false }); // var newPanel = $scope.panelShow; $scope.openCon =function(idx){ // 只打开唯一一个: // if($scope.panelShow[idx].status == false){ // angular.forEach($scope.panelShow,function(i){ // i.status = false // }); // } $scope.panelShow[idx].status = !$scope.panelShow[idx].status; } }); </s
  • 相关阅读:
    sql基础笔记备忘
    论坛---挂掉的思考
    http response
    跑步肋骨下方疼
    Golang
    svn rollback: 恢复到上一版本
    中国时区
    crontab
    初识redis
    siege
  • 原文地址:https://www.cnblogs.com/vonson/p/7801459.html
Copyright © 2011-2022 走看看