有誰知道我在哪裏可以找到kendo ui listview和angularjs的例子? 我能找到網格和下拉列表的例子。 但是所有其他控件呢?沒有例子...我如何使用kendo ui listview和angularjs
7
A
回答
4
下面應該工作:
<div ng-controller="MyController">
<div>Products: {{products.total()}}</div>
<div kendo-list-view k-data-source="products" k-template="template">
</div>
<script id="template" type="text/x-kendo-template">
<div>
#= name #
</div>
</script>
</div>
<script>
function MyController($scope) {
$scope.products = new kendo.data.DataSource({
data: [
{ id:1, name:'Tennis Balls', department:'Sports'},
{ id:2, name:'Basket Balls', department:'Sports'},
{ id:3, name:'Oil', department:'Auto'},
{ id:4, name:'Filters', department:'Auto'},
{ id:5, name:'Dresser', department:'Home Furnishings' }
]
});
$scope.template = $("#template").html();
}
</script>
這裏有一個現場演示:http://jsbin.com/ODElUfO/69/edit
1
一個關鍵的一點要記住,如果你使用的劍道模板,與角的結合,你必須綁定到dataItem。所以它會是{{dataItem.name}}而不是{{name}}。如果你使用劍道模板,它將只是#=名稱#。小但棘手的區別。另外,不要忘記單向綁定,因爲通常您不需要雙向模板,所以{{:: dataItem.name}}。
1
你可以找到的官方Telerik的列表視圖角度位置例如:http://demos.telerik.com/kendo-ui/listview/angular
至於Atanas Korchev的例子,我寧願做這樣。 在這裏,您可以在listOptions中更改您的列表視圖的設置,並且您可以使用角度指令編輯您的模板而無需使用jQuery。
<div ng-controller="MyController">
<div>Products: {{products.total()}}</div>
<div kendo-list-view
k-options="listOptions"
k-on-change="onListChange()"
ng-show="listVisible">
<div k-template>
{{ dataItem.name }}
</div>
</div>
</div>
<script>
function MyController($scope) {
$scope.listOptions = {
dataSource: new kendo.data.DataSource({
data: [
{ id:1, name:'Tennis Balls', department:'Sports'},
{ id:2, name:'Basket Balls', department:'Sports'},
{ id:3, name:'Oil', department:'Auto'},
{ id:4, name:'Filters', department:'Auto'},
{ id:5, name:'Dresser', department:'Home Furnishings' }
]
}),
selectable: true
};
$scope.onListChange = function() {
// do something
}
$scope.listVisible = true;
}
</script>
相關問題
- 1. 在Kendo UI中使用AngularJS
- 2. 如何使用Kendo-zoomable視圖和AngularJS
- 3. Kendo UI ListView Drag - Drop
- 4. Kendo ui if else angularjs
- 5. kendo UI Grid in angularjs
- 6. 如何使用Kendo UI Slider和Angular 2
- 7. 使用KENDO Draggable拖動KENDO UI Listview的單個元素
- 8. 選擇Kendo UI ListView項目
- 9. 如何使用kendo-UI打開外部Angularjs html文件
- 10. 如何使用AngularJS指定optionLabelTemplate Kendo UI DropDownList
- 11. 如何使用angularjs格式化貨幣像kendo ui的模板
- 12. Kendo UI mobile的AngularJS路由
- 13. Kendo UI AngularJS 1.6項目
- 14. Kendo UI Web ListView和外部模板以及如何呈現HTML
- 15. 使用AngularJs和WebApi創建Kendo UI網格
- 16. 使用Kendo UI和AngularJS創建基本數據網格
- 17. 使用Kendo-UI網格和AngularJS不更新的計算字段
- 18. 嘗試在AngularJS和Webpack中使用Kendo UI時出錯
- 19. 如何使用Kendo UI進行下拉
- 20. 如何使用kendo UI分割窗格
- 21. 如何在oracle adf中使用kendo UI?
- 22. 我可以將Visual Studio 2010用於Kendo UI,Kendo UI Web或Kendo UI Mobile嗎?
- 23. Angularjs ui-utils ui-scroll如何使用
- 24. Kendo ui圖標不顯示,如果我使用模板
- 25. 我如何使用嵌套的Json來填充Kendo UI網格?
- 26. 使用AngularJS ng-disabled啓用/禁用kendo ui下拉列表
- 27. 使用kendo ui網格和backbone.js
- 28. Kendo UI Grid使用In-Cell和Inline
- 29. Kendo UI ListView消耗數組對象
- 30. Kendo UI中ListView的日期過濾器
有些問題:1.該模板可以在另一個HTML嗎?像部分? 2.我可以在模板內使用角度綁定嗎?單個項目模板的範圍是什麼?我必須在模板中使用#:someProperty#嗎? –
1.是的,只要$(「#template」)可以找到它。 2.不確定。如果一個角模板可以被定義爲一個JavaScript函數。那些是劍道模板texpressions。 2.範圍是來自數據源的當前項目。 –
我有一個類似於你的例子,但不是#= name#它是{{name}},它不起作用,所以無論是範圍還是我不知道的東西(一些角度的解釋......) –