Create a menu like in AngularJs Material website

后端 未结 7 2043
有刺的猬
有刺的猬 2020-12-23 20:25

I want to create a menu that looks like the one in AngularJs Material website (https://material.angularjs.org)

\

7条回答
  •  情歌与酒
    2020-12-23 20:42

    You don't NEED any of this, if you want an identical UX and appearance, I guess there is no reason not to import the service and all. But, if all you want is the collapsability you could solve this with the ng-class directive without importing much; depending how you have your scope setup you might need a different variable for each collapsable zone, something like this:

    Toggle Click zone
    Stuff that gets hidden
    More stuff to hide

    In your controller $scope declarations

    $scope.collapsedA = true //if you want it to start collapsed
    

    and then in your css something like

    .collapsable{
        transition: all .2s ease-in-out;
        min-height: 20px;
        overflow: hidden;
    }
    .collapsable.collapsed{
        height: 0;
        min-height: 0;
    }
    

提交回复
热议问题