Forum Post: RE: Binding jsdo kendo.datasource to a listview using angularjs

  • Thread starter Thread starter riche
  • Start date Start date
Status
Not open for further replies.
R

riche

Guest
It was my fault. I added a wrapper div to the html and used k-template and it works. kendo-mobile-view id="list" k-title="'List View!'" k-layout="'default'" k-on-before-show="OnBeforeShow()" ng-controller="ListController" kendo-mobile-list-view id="conList" class="item-list" k-data-source="listDataSource" div k-template h3 class="item-title" {{ dataItem.cust_no }} /h3 p class="item-info" {{ dataItem.ip_address }} /p /div /kendo-mobile-list-view /kendo-mobile-view With that, I am getting my data. My app.js entry-point: It wasn't working originally with my template defined in the index page due to the fact that I had my factory for the templates (like shown in the sushi app) wrong. I looked more closely at that and got it working the original way: var app = angular.module('ListMobileApp', [ 'kendo.directives' ]); app.run(["$rootScope", function($rootScope) { $rootScope.initialView = "views/home.html" }]) app.factory('templates', function() { return { conTemplate: $("#conTemplate").html() }; }); Template definition in the index.html: script id="conTemplate" type="text/x-kendo-templ" h3 class="item-title" {{ dataItem.cust_no }} /h3 p class="item-info" {{ dataItem.ip_address }} /p /script And the use of the template in my list view (back to how I had it in the original post): kendo-mobile-view id="list" k-title="'List View!'" k-layout="'default'" k-on-before-show="OnBeforeShow()" ng-controller="ListController" kendo-mobile-list-view id="conList" class="item-list" k-template="templates.conTemplate" k-data-source="listDataSource" /kendo-mobile-list-view /kendo-mobile-view And the missing piece was passing the templates into the controller for the list: app.controller("ListController", ['$rootScope', '$scope', ' templates ', function($rootScope, $scope, templates ) { $scope.templates = templates; Oh, didn't need the schema definition (glad because it was a lot of extra work and I only added it because I thought I might need it to do the mapping).

Continue reading...
 
Status
Not open for further replies.
Back
Top