hottowel (durandal) + typescript -
this first post, wish me luck :)
i want use hot towel(durandal) + typescript , followed these threads: - how-can-i-use-a-class-for-my-shell-viewmodel-in-durandal - how-to-use-fancybox-in-combination-with-durandal-en-typescript - incorrect-this-in-select
and tried durandaltypescriptexample sample
this sample not run error:
"server error in '/' application.
the resource cannot found. "
at first decided change viewmodels typescript, , after shell either, in both situation got error:
this shell.ts code (which used this sample) :
/// <reference path="../durandal/durandal.d.ts" /> import _router = module('durandal/plugins/router'); import app = module('durandal/app'); export var router = _router; export function search() { app.showmessage('search not yet implemented...'); } export function activate() { return router.activate('welcome'); }
and got error:
- javascript runtime error: 'exports' undefined
any idea?
and if possible, workable solutions appreciated.
thanx guys let's see happen.
i had same problem durandaltypescriptexample. code in project demonstrated how can implement typescript code in viewmodel file, if make sure dispose publicly durandal requied variables. @ least activate function , title variable.
see code example below:
/// <reference path="../../dts/knockout/knockout.d.ts" //> export class viewmodel { title: string = 'home view'; mytitle: knockoutobservablestring; //mytitle can referenced in home.html vm.mytitle public activate() { this.mytitle = ko.observable(this.title + " ko title"); return true; } } export var vm = new viewmodel(); //the durandal plugin-interface variables export var title = vm.title; export var activate = function () { return vm.activate(); };
since found no ready made project demonstrate had make own. see version of hot towel project on github:
Comments
Post a Comment