This is a migrated thread and some comments may be shown as answers.

TypeScript modules / AMD / require.js

1 Answer 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Remco
Top achievements
Rank 1
Remco asked on 29 Jan 2014, 09:52 AM
I am new to Kendo UI Mobile. I am familiar with building Kendo UI SPA applications using TypeScript modules. In debug configuration require.js is used to load the modules. In release configuration all modules are compiled into a single minified file. I typically use a bootstrapper module to create the kendo.Router, kendo.Layout, kendo.View and my view model instances. My view models are TypeScript classes that inherit from kendo.data.ObservableObject.

I am curious how I would go about creating a Kendo UI Mobile app using TypeScript modules. From reading the documentation on Kendo UI Mobile it appears the views are hooked of to their view models declaratively using data-model assuming the view model instances are global variables. Is there an imperative way of hooking up the views to their view models inside a TypeScript module so that the view model instances are not required to be global variables?

many thanks,

Remco

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 02 Feb 2014, 12:24 PM
Hello Remco,

this approach is supported currently, mostly due to performance reasons. When instantiated, the mobile view automatically instantiates its containing widgets (based on role data attributes). kendo.bind essentially does the same, which is quite a costly operation (full DOM traversal). By specifying the ViewModel reference up-front, the widget instantiation and ViewModel binding is done in a single pass. 

Regards,
Petyo
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Remco
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or