bootstrap-treeview + angular 使用
bootstrap-treeview是什么
bootstrap-treeview是一款效果非常酷的基于bootstrap的jQuery多级列表树插件。
怎样使用bootstrap-treeview
插件依赖
boostrap-treeview插件依赖于jquery和bootstrap,需要引用相对应版本的这两个插件才能使用bootstrap-treeview。
引用bootstrap-treeview
需要应用bootstrap-treeview.js文件可以从github下载。
html结构
可以使用任何html dom元素作为改列表树容器
<div id="dictree"></div>
调用插件
angular.element("#dicTree").treeview({
data: respose.data,
levels: 2,
color: '#000000',
backColor: '#FFFFFF',
href: '#node-1'
});
其中data为我们的数据,数据以数组对象的形式组织,还可以设置如上其他属性背景色、前景色、默认展开的级别。
数据结构

在本次实例中我们使用了三个属性,text、id、href属性,数据结构如下:
[{
"id":"41",
"text":"业务字典",
"href":"01",
"nodes":[{
"id":"42",
"text":"法律法规管理系统",
"href":"001","
nodes":[{
"id":"24","text":
"业务类别","href":"0001",
"nodes":null}]}]}]
与angular结合
通过调用http远程服务调用服务器上的数据,也就是已经写好的接口:
(function () {
var controllerId = 'app.views.dictionarymanager.index';
var myModule = angular.module("app");
myModule.controller(controllerId, ['$scope','$http', function ($scope,$http) {
//初始化treeview
getDictinary();
function getDictinary() {
$http({ method: 'get', url: '/api/DictionaryMain/get' }).then(
function sunccessCallback(respose) {
angular.element("#dicTree").treeview({
data: respose.data,
levels: 2,
color: '#000000',
backColor: '#FFFFFF',
href: '#node-1'
});
}, function errorCallback(respose) {
alert(respose.data);
});
}
}]);
})();
其他
其他内容不在本次介绍的范围内,如全局参数、可用的方法和事件不在本次讨论范围内,如果想要详细了解请访问链接。
bootstrap-treeview + angular 使用的更多相关文章
- Bootstrap treeview增加或者删除节点
参考(AddNode: http://blog.csdn.net/qq_25628235/article/details/51719917,deleteNode:http://blog.csdn.ne ...
- 初始化bootstrap treeview树节点
最近在做启明星图库时,使用了Jquery Bootstrap Treeview插件.但是,遇到了一个初始化的问题.先看效果如下: 当用户打开图库时,左边分类第一个类别是“所有分类”,默认需要选中. ...
- angularJs , json,html片段,bootstrap timepicker angular
css .demotest { width: %; height: auto; overflow: auto; position: relative; margin: auto; margin-top ...
- AngularJs angular.bind、angular.bootstrap、angular.copy
angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...
- 【angular+bootstrap】angular初级的时间选择器
近期的一个项目,是用angular来写的,本来框架就是第一次接触,使用相关插件的时候就感觉更加没有头绪了,其中一个插件就是时间选择器.比较好用时间选择器就是bootstrap里面的datetimepi ...
- BootStrap TreeView使用示例
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Angular - - angular.bind、angular.bootstrap、angular.copy
angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...
- Angular Js 与bootstrap, angular 与 vue.js
今天突然接到电话, 问我他们的区别 虽然平时看了,但是没记住,凉凉是肯定的 总结一下: bootstrap不算是javascript框架,它只是一个前端的ui框架,然后有一些附带的js插件而已.an ...
- bootstrap treeview 树形数据生成
这个问题还是挺经典的,后台只是负责查出所有的数据,前台js来处理数据展示给treeview;show you the code below:<script> $(function () { ...
- bootstrap treeview实现菜单树
本博客,介绍通过Bootstrap的treeview插件实现菜单树的功能. treeview链接:http://www.htmleaf.com/Demo/201502141380.html ORM框架 ...
随机推荐
- 36. Valid Sudoku (Array; HashTable)
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...
- Codeforces Beta Round#2
Codeforces Beta Round#2 http://codeforces.com/contest/2 A 模拟题 #include<bits/stdc++.h> using na ...
- 【校招面试 之 C/C++】第3题 为什么要内存对齐?以及内存对齐的方式
1.为什么要进行内存对? 参考:https://blog.csdn.net/a369000753/article/details/51188915 所谓内存对齐,是为了让内存存取更有效率而采用的一种编 ...
- 最近公共祖先 · Lowest Common Ancestor
[抄题]: Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. “Th ...
- Extjs面板和布局初探
面板相当于一张干净的白纸,如果直接在上面添加内容,将很难控制面板中内容的显示位置,面板元素越多就越显得凌乱,所以需要在面板上划分不同的区域,将面板内容展示到希望的位置上.ExtJS通过提供多种布局类来 ...
- [leetcode]139. Word Break单词能否拆分
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine ...
- linux,windows 可执行文件(ELF、PE)
现在PC平台流行的可执行文件格式(Executable)主要是Windows下的PE(Portable Executable)和Linux的ELF(Executable Linkable Format ...
- vc到vs2015消息函数
afx_msg LRESULT OnMyIconNotify(WPARAM wParam,LPARAM lParam); vc6 可以是void vs2015不可以 ON_MESSAGE(MYWM_ ...
- Ubuntu 网卡多个 IP 地址
临时添加 IP 地址 首先,让我们找到网卡的 IP 地址.在我的 Ubuntu 15.10 服务器版中,我只使用了一个网卡. 运行下面的命令找到 IP 地址: 复制代码 代码如下: sudo ip a ...
- spring mvc , spring data jpa 知识点
<mvc:view-controller path="/login" view-name="login.jsp"/> <!-- 会直接跳到/W ...