我好像撞墙了,我无法分解.我正在使用angular + typescript,并希望使用requirejs.定义了多个角度应用程序,这些应用程序依赖于正文上的data-app-name属性进行加载.
文件夹结构(简化):
|- Libs
|- angular
|- some-plugin
|- angular-some-plugin // Exposes an angular.module("ngSomePlugin")
|- require.js
|- Common
|- Common.ts // Exposes an angular.module("common")
|- App1
|- Controllers
|- SomeController.ts
|- SomeOtherController.ts
|- Services
|- SomeService.ts
|- Main.ts
|- App.ts
|- App2
// same as above
|- AppX
// same as above
|- Index.html
|- Main.ts
Run Code Online (Sandbox Code Playgroud)
内容:
index.html的:
// All these attributes are set dynamically server-side
<body id="ng-app-wrapper" data-directory="App1" data-app-name="MyApp">
<script src="Libs/require.js" data-main="Main"></script>
</body>
Run Code Online (Sandbox Code Playgroud)
Main.ts:
console.log("Step 1: Main.js"); …Run Code Online (Sandbox Code Playgroud) 我正在尝试实现从一个客户端到另一个客户端的聊天.在搜索时,我遇到了有趣的SignalR库,用于服务器推送操作.
假设客户端向另一个客户端发送消息,但该客户端此时处于脱机状态.当他回到网上时,他应该看到他在离线时收到消息的通知.SignalR会将其对话存储在某处吗?如何在我的数据库中存储会话?如何让客户端在收到离线消息时看到通知?
任何人都可以为我提供这样的教程吗?我只找到了在线聊天教程.
亲切的问候
我忘记了我的Orchard管理员密码,所以我搜索了如何(手动)重置它.我发现这篇文章是关于如何实现这一目标的.
所以我去了我的服务器,在WebMatrix中打开了网站,打开了数据库,设置了一个新密码,并将PasswordFormat设置为Clear.我打开了网站并尝试登录,但仍然说用户名和/或密码不正确.
有没有人遇到类似的问题?关于它为什么不起作用的任何想法?
我正在使用Orchard 1.8和WebMatrix 3.
谢谢
说我有这个功能:
function doSomething(n) {
for (var i = 0; i < n; i++) {
doSomethingElse();
}
}
Run Code Online (Sandbox Code Playgroud)
如何测试该doSomethingElse函数是否被调用n次?
我尝试过类似的东西:
test("Testing something", function () {
var spy = sinon.spy(doSomethingElse);
doSomething(12);
equal(spy.callCount, 12, "doSomethingElse is called 12 times");
});
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用,因为你必须在doSomething()调用原始时调用间谍doSomethingElse().如何使用QUnit/sinon.js完成这项工作?
编辑
也许这甚至不是一个好主意?这是否属于'单元测试',因为调用了另一个函数?
我已经阅读了这篇文章,以了解如何动画变化ng-src.但这似乎不起作用,只是第一次加载页面时.
我想在ng-src图像更改时创建动画,并提出以下指令:
myApp.directive("imageChange", function ($timeout) {
return {
restrict: "A",
scope: {},
link: function (scope, element, attrs) {
element.on("load", function () {
$timeout(function () {
element.removeClass("ng-hide");
element.addClass("ng-show");
}, 500); // This also is shitty, cause its a fixed value
});
attrs.$observe("ngSrc", function () {
element.removeClass("ng-show");
element.addClass("ng-hide");
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
但它似乎没有动画.什么应该是动画ng-src变化的正确解决方案?
JSFIDDLE:http://jsfiddle.net/wszk0tr1/3/
amd ×1
angular ×1
angularjs ×1
animation ×1
javascript ×1
orchardcms ×1
qunit ×1
requirejs ×1
signalr ×1
sinon ×1
typescript ×1
unit-testing ×1