Passing Route Parameters to a View

2 posts, 1 answers
  1. Brendan
    Brendan avatar
    2 posts
    Member since:
    Feb 2012

    Posted 29 Dec 2014 Link to this post

    I'm starting a new project and would like to use Kendo's SPA along with RequireJS for the design; however, I'm running into a roadblock that I just can't get by and I'm hoping someone here has dealt with it in the past.  My issue comes down to passing route parameters to a view for rendering.  My current sample code is as follows:

    (function () {
            deps: ["js/jquery"]
        require(['app'], function(App){

    ], function (kendo, list) {
        var router = new kendo.Router({
            routeMissing: function (e) {
                console.log('No Route Found', e.url);
        router.route("list/(:id)", function(id) {
            var myIdParameter = id;
            // TODO Find a way to pass the myIdParameter to the view I'm about to render.
            // Render the view in the "app" div
        return router;

    define(['kendo/js/kendo.all.min'], function (kendo) {
        // TODO I would like to have the "1234" value passed from the route parameter
        var viewModel = kendo.observable({
            id: "1234"
        var options = {
            model: viewModel
        return new kendo.View(

    My goal is to use the ListController for the various js logic for creating various kendo widgets for the view I'm trying to render; however, If I can't find a good way to pass parameters along to use with my future datasource calls I going to be stuck.  Any push in the right direction here would be greatly appreciated.

  2. Answer
    Petyo avatar
    2437 posts

    Posted 30 Dec 2014 Link to this post

    Hello Brendan,

    the SPA view itself does not have the concept of parameters. What you may do in that case is to actually set the state of the view model instance, thus configuring the view options. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top