- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
这是我的第一篇文章,祝我好运:)
我想使用 hot towel(durandal) + typescript ,我遵循了这些线程:- 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
也试过DurandalTypescriptExample样本
此示例未运行并出现此错误:
找不到资源。 "
起初我决定只用 typescript 改变我的 View 模型,然后在那个 shell 之后,但在这两种情况下我都得到了这个错误:
这是我的 shell.ts 代码(我使用了 this 示例):
/// <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');
}
我得到了这个错误:
- JavaScript runtime error: 'exports' is undefined
有什么想法吗?
如果可能的话,我们会感谢可行的解决方案。
谢谢大家,让我们看看会发生什么。
最佳答案
我在使用 DurandalTypescriptExample 时遇到了同样的问题。然而,该项目中的代码演示了如何在 viewmodel 文件中实现 typescript 代码,前提是您只确保公开处理 durandal 所需的变量。至少 activate 函数和 title 变量。
参见下面的代码示例:
/// <reference path="../../dts/knockout/knockout.d.ts" //>
export class ViewModel {
title: string = 'Home View';
MyTitle: KnockoutObservableString; //MyTitle can be referenced in home.html as vm.MyTitle
public activate() {
this.MyTitle = ko.observable(this.title + " with my 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(); };
由于我找不到现成的项目来演示这一点,所以我不得不自己制作。在 github 上查看我的 Hot Towel 项目版本:
关于typescript - hottowel (durandal) + typescript ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16633877/
Nuget 说我已经为我正在检查的项目安装了 Durandal Transitions 包,但是 ~/Scripts/durandal/transitions仅包含默认过渡 entrance.js 其
每次我读到有关 Javascript 的新内容时,我都会阅读有关 Durandal 和 Aurelia 的内容。我在很多博客上听到开发人员要求从 Durandal 升级到 Aurelia 或类似的版本
在我基于 HotTowel 的项目中,我使用 Durandal 1.1.1 进行路由。 我有一个登录路由,如果用户未登录,我想激活该路由。 我的路线配置如下: var routes = [ {
每次我读到有关 Javascript 的新内容时,我都会阅读有关 Durandal 和 Aurelia 的内容。我在很多博客上听到开发人员要求从 Durandal 升级到 Aurelia 或类似的版本
Durandal route 星号的用途是什么?这是来自 the Docs 的示例: route:'knockout-samples*details' 编辑:使用 Durandal 2.0 最佳答案
Durandal 路由中星号的用途是什么?这是来自 the Docs 的示例: route:'knockout-samples*details' 编辑:使用 Durandal 2.0 最佳答案 您引用
我的 Durandal 路由配置如下。 var routes = [ ....... More Routes Here..... { url: 'login', moduleId: '
我正在使用 Durandal 2.0。我有一个搜索 View ,想将所选项目传递到详细信息 View 。我知道如何传递 Id,但由于在这种情况下搜索具有整个对象,因此我想在导航时传递对象。我以为我可以
我搜索如何在撰写数据绑定(bind)上停用转换, 因为我在 chrome 上的内容 html 并不美观而且小错误。 因为我在过渡时有一个滚动水平打印,并且在移动鼠标后消失了。 内容在 iFrame 中
在我的 shell 中,我按照以下方式设置了路线: router.map([ { route: '', title: 'Search', moduleId: 'viewmode
我正在尝试使用 John Papa 的 HotTowel 模板实现 SPA。我可以做多少级的 ko compose 有限制吗? 在它调用的 shell.html 中 在我的事件 View 中,我尝试
我需要帮助在 Durandal 路由器中动态添加/删除路由。我想要的是在用户登录后,我将能够根据登录用户的类型添加或删除特定路线。 我试图从 visibleRoutes/allRoutes 数组中添加
我正在看的文章是Durandal Router . 下 mapAuto ,它说我们可以在 url #/customers/1 中传递 splat 参数.和 activate viewmodel 中的函
我正在查看这些路由信息对象结构的文档,但没有找到任何内容。由于 Durandal 使用其他 JS 库,我不确定它属于什么(也许是 sammy?)。 我面临两个问题:问题 #1 我想在路线信息中使用一个
我有一个现有的 Durandal.js 应用程序,它利用了所有 ES5 功能,但我想将它升级到新的 Aurelia 平台。什么是正确的升级路径?最简单的升级方式是什么?是否有包含升级路径的文档? 最佳
我正在开发 Hottowel 项目,并更新到 Durandal 2.0。我已经关注了Converting from 1.x to 2.0 guide ,但我仍然有一些问题: 1.加载router插件总
在我看来......这种方式的初始路线是通过以下方式定义的: { route: '', moduleId: 'viewmodels/customers', title: 'customers', na
我想知道是否有人在 Durandal.js 上遇到过类似的问题。 我收到间歇性的“未找到 View 。搜索”错误,很难复制,因为只是偶尔发生。 当 createView 函数无法定位 View 时,它
当您在 SPA 代码中的某处遇到脚本错误时,整个应用程序变得完全没有响应并且您无法导航到任何其他页面(视图)。似乎 durandal 只是卡住了! (唯一的出路是点击刷新再次启动SPA) 在 Du
两者有什么区别,什么时候适合使用它们?我已经看过文档,但还没有完全弄清楚。 最佳答案 这两个事件都是 Durandal 生命周期回调的一部分。 activate() 允许新对象执行自定义激活逻辑。 (
我是一名优秀的程序员,十分优秀!