关于angularjs指令示例

关于angularjs指令示例,angularjs,angularjs-directive,Angularjs,Angularjs Directive,当我想点击UL扩展下面的每个级别时,请点击包的其余部分。 Html代码: 指令代码: var myApp=angular.module(“myApp”,[]); myApp.directive('showHide',[function(){ 返回{ 限制:“A”, 范围:{ 值:“=”, 显示:“=”, 张:&“ }, 模板:“{value.title}”\ \ \ {{contentValue}}\ ', 链接:功能(范围、IELENT、iAttrs){ iElement.find(“

当我想点击UL扩展下面的每个级别时,请点击包的其余部分。

Html代码:


指令代码:

var myApp=angular.module(“myApp”,[]);
myApp.directive('showHide',[function(){
返回{
限制:“A”,
范围:{
值:“=”,
显示:“=”,
张:&“
},
模板:“{value.title}”\
    \
  • \ {{contentValue}}\
', 链接:功能(范围、IELENT、iAttrs){ iElement.find(“h5”)。在(“单击”上,函数(){ 作用域:$apply(函数(){ scope.show=!scope.show; }); }); } }; }]);
控制器代码:

myApp.controller('exampleCtrl',['$scope',“$http”,函数($scope,$http){
$scope.data={
"1":{
“标题”:第一级",
“内容”:[
"1111",
"2222222",
"33333333333"
]
},
"2":{
“标题”:第二级",
“内容”:[
"1111",
"2222222",
"33333333333",
"44444444444444444444444444"
]
},
"3":{
“标题”:第三级",
“内容”:[
"1111",
"2222222",
"33333333333",
"44444444444444444444444444",
"5555555555555555555555555555555555555555555555555555"
]
}
};
$scope.isShow=false;
$scope.zhangshow=函数(){
$scope.isShow=false;
};
}]);`
看看地址:

帮帮我!谢谢!

你可以用


此内容在模板中是直接的。
{{group.content}
手风琴组的主体会随着内容的增长而增长

添加项 {{item}} 我也可以有标记! 这只是一些用来说明奇特标题的内容。
问题是什么?问题是什么?您不能从ui引导/角度引导使用手风琴吗?谢谢!我可以从ui引导使用手风琴。
<accordion close-others="oneAtATime">
    <accordion-group heading="Static Header, initially expanded" is-open="status.isFirstOpen" is-disabled="status.isFirstDisabled">
      This content is straight in the template.
    </accordion-group>
    <accordion-group heading="{{group.title}}" ng-repeat="group in groups">
      {{group.content}}
    </accordion-group>
    <accordion-group heading="Dynamic Body Content">
      <p>The body of the accordion group grows to fit the contents</p>
        <button class="btn btn-default btn-sm" ng-click="addItem()">Add Item</button>
        <div ng-repeat="item in items">{{item}}</div>
    </accordion-group>
    <accordion-group is-open="status.open">
        <accordion-heading>
            I can have markup, too! <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.open, 'glyphicon-chevron-right': !status.open}"></i>
        </accordion-heading>
        This is just some content to illustrate fancy headings.
    </accordion-group>
  </accordion>