zoukankan      html  css  js  c++  java
  • angular 基本树结构

    HTML:

    http://www.ngnice.com/showcase/#/tree/basic

    <link rel="stylesheet" href="views/tree/basic.css"/> <div class="tree"> <ul> <li ng-repeat="country in vm.countries" ng-class="{closed:country.closed}"> <div ng-click="country.closed=!country.closed"> <span class="glyphicon" ng-class="country.closed?'glyphicon-plus':'glyphicon-minus'"></span> <img ng-src="images/{{country.flag}}"/> {{country.label}} </div> <ul ng-class="{hidden: country.closed}"> <li ng-repeat="province in country.provinces" ng-class="{closed:province.closed}"> <div ng-click="province.closed=!province.closed"> <span class="glyphicon" ng-class="province.closed?'glyphicon-plus':'glyphicon-minus'"></span> {{province.label}} </div> <ul ng-class="{hidden: province.closed}"> <li ng-repeat="city in province.cities" ng-click="vm.select(country, province, city)"> {{city.label}} </li> </ul> </li> </ul> </li> </ul> </div> <div ng-if="vm.city">国家:<img ng-src="images/{{vm.country.flag}}">{{vm.country.label}} 省份:{{vm.province.label}} 城市:{{vm.city.label}} </div>

    CSS:

    .tree li { cursor: pointer; padding-left: 1.3em; } .tree ul { list-style: none; padding-left: 0; }

    JS:

    'use strict'; angular.module('ngShowcaseApp').controller('ctrl.tree.basic', function ($scope, CityData) { var vm = $scope.vm = {}; vm.countries = CityData; vm.select = function(country, province, city) { vm.country = country; vm.province = province; vm.city = city; }; });

     

     

  • 相关阅读:
    [收集]Grid Animation-01
    陕西航天大学横幅动态测试
    IPC机制
    Android使用权限
    DDMS
    看懂UML类图和时序图
    Frameworks detected: Android framework is detected in the project
    CoordinatorLayout父布局的Behavior
    Android权限记录
    AndroidManifest.xml文件中属性记录
  • 原文地址:https://www.cnblogs.com/bmaker/p/5751515.html
Copyright © 2011-2022 走看看