使用Java API(我猜想这适用于任何其他TWS Interactive Brokers客户端API),出现错误“未为请求找到安全定义”。FAQ和其他资源毫无帮助。
Contract contract = new Contract();
int id = incId;
System.out.println("Oder Id " + id );
// use UTC seconds as transaction id
// This is the problem you need to have a blank contractId
contract.m_conId = 12345;
contract.m_symbol = signal.symbol;
contract.m_secType = "STK";
contract.m_expiry = "";
contract.m_strike = 0;
contract.m_exchange = "SMART";
contract.m_primaryExch = "ISLAND";
contract.m_currency = "USD";
//etc
Order order = new Order();
// set order fields
order.m_account = "XXXXXX";
order.m_orderId = id;
//etc
GetInstance().wrapper.m_client.placeOrder(id, …Run Code Online (Sandbox Code Playgroud) 我正在将一些核心的角度内容移植到一个新项目中。现在我收到注入器错误,但堆栈跟踪/角度错误页面不显示有问题的注入错误的类名。我得到的只是
\n\nError: $injector:modulerr\nModule Error\nRun Code Online (Sandbox Code Playgroud)\n\n通常那里有一个类名。现在我必须检查每个类(数十个)并手动检查导入。难道就没有更好的办法吗?我在添加类时就看到了这种情况的发生。有时它会显示丢失的注入的名称,有时它只是显示为空白,否则堆栈跟踪会正确识别丢失/错误的注入。
\n\n是否有一些额外的调试模式可以获取此信息?
\n\n完整的(无用的)堆栈跟踪:
\n\nFailed to instantiate module FSApp due to:\nError: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=FSApp&p1=Error\xe2\x80\xa6cape%2Fmain%2Fresources%2Flib%2Fangular-1.2.16%2Fangular.min.js%3A32%3A445)\n at Error (native)\n at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:6:450\n at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:33:332\n at Array.forEach (native)\n at q (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:7:280)\n at e (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:32:445)\n at http://fs/main/resources/lib/angular-1.2.16/angular.min.js:33:18\n at Array.forEach (native)\n at q (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:7:280)\n at e (http://fs/main/resources/lib/angular-1.2.16/angular.min.js:32:445\nRun Code Online (Sandbox Code Playgroud)\n\n如果您想尝试重现此情况,请提交您的更改。到处删除几个文件。运行你的角度应用程序。如果删除得足够多,您很快就会收到空白注射器错误。
\n在这个小提琴http://jsfiddle.net/FlavorScape/fp1kktt9/我尝试在控制器上设置属性,而不是直接在$ scope.在模板中(在生产中)我们只做myAliasCtrl.somePropertyList和ng-repeat工作.
但是,这在测试中不起作用.我不知道如何在控制器上获取/分配属性.
更新: 我的测试环境中一定有一些奇怪的本地化问题,因为我确实让ng-repeat工作.注意有两个子元素,即使该属性在别名控制器上.http://jsfiddle.net/FlavorScape/2adn983y/2/
但是,我的问题仍然是,我如何获得对该编译控制器的引用来说,创建一个间谍?(或者只是获得别名控制器的引用)?
这是来源:
angular.module('myApp', [])
.directive('myTestDirective', function () {
return {
restrict: 'E',
scope: {
myBinding: '='
},
replace: true,
template: '<div ng-if="isRendered">TEST<div ng-repeat="foo in myCtrl.fooList">{{foo}}</div></div>',
controller: 'myTestController',
controllerAs: 'myCtrl'
};
})
.controller('myTestController', function($scope) {
$scope.isRendered = true;
// if i reference this, ng-repeat works
$scope.fooList = ["boob","cat", "Tesla"];
});
describe('myTest directive:', function () {
var scope, compile, validHTML;
validHTML = '<div><my-test-directive my-binding="isRendered"></my-test-directive></div>'; //i
beforeEach(module('myApp'));
beforeEach(inject(function($compile, $rootScope){
scope = $rootScope.$new();
scope.isRendered = …Run Code Online (Sandbox Code Playgroud) 假设我正在递增这样的整数
{% capture page %}{{ page | plus: '1' }}{% endcapture %}
Run Code Online (Sandbox Code Playgroud)
我怎么能像这样垫?
{% capture paddedPage %}{{ page | pad '0', 4 }}{% endcapture %}
Run Code Online (Sandbox Code Playgroud)
其中4是填充位置的数量,'0'是填充字符串?最终结果如下所示:0001page的值为1.我如何在内联或过滤器中执行此操作?
我想它可以表示为sprintf('%d4',页面),但显然这种语法不适用于liquid/jekyll.
我对jekyll/liquid语法感到非常失望(甚至没有原始模数!)除此之外,我怎么能填充带有前导字符的字符串?
所以,这真的很愚蠢。但不可能通过谷歌搜索,因为未定义的模块实际上是module. 我在单元测试中消除了所有其他 TS 错误,除了最后一个错误:
main/components/login/loginController.Spec.ts(12,7):错误 TS2304:找不到名称“模块”。
有些人说,“只需包含 angular-mocks.js”,但我已经这样做了,它消除了其他一些错误,但没有消除这个错误。
这是我的参考资料:
/// <reference path="../../typings/angularjs/angular.d.ts" />
/// <reference path="../../typings/jquery/jquery.d.ts" />
/// <reference path="../../typings/d3/d3.d.ts" />
/// <reference path="../../typings/jasmine/jasmine.d.ts" />
/// <reference path="../../typings/angularjs/angular-mocks.d.ts" />
Run Code Online (Sandbox Code Playgroud)
这是一个说明问题的简单测试。
describe('Login Controller Spec', function() {
beforeEach(function() {
// uh oh
module('App');
inject(function(_$controller_, $rootScope) {
scope = $rootScope.$new();
controller = _$controller_;
navCtrl = controller('loginController', { $scope: scope});
});
});
it('should call init', function(){
//...
});
});
Run Code Online (Sandbox Code Playgroud)
我应该获得其他任何库的定义吗?
为什么这个简单的ng-click示例不起作用?我已经在生产中使用角几个月了,但是这个笨蛋让我感到困惑.
http://plnkr.co/edit/9Rp5JD?p=preview
如果你注意到,ng-show属性正在运行......为什么不是点击?它总是警告默认值而不是角度点击.
<div ng-show="showTest" ng-click="alert('angular click')" onclick="alert('default click')">Default or angular click?</div>
<div ng-show="dontShowMeIsNotDefinedSoIWontShow" >Not showing me, I know angular is working!</div>
Run Code Online (Sandbox Code Playgroud)
没有孤立的范围,根本没有指令......只是一个div.您可以删除onclick ....其他警报永远不会触发.我确定无论问题是什么,我都会变得太近视而无法找到它.
其余的无聊配置:
angular.module('plunker', []);
var app = angular.module('plunker', [
'plunker'
]);
app.config( function( ) {
'use strict';
});
app.controller('MainCtrl', function($scope) {
var that = this;
$scope.showTest = true;
});
Run Code Online (Sandbox Code Playgroud)
整个HTML:
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<link data-require="bootstrap-css@*" data-semver="3.2.0" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
<script>
document.write('<base href="' + document.location + '" />');
</script>
<link rel="stylesheet" …Run Code Online (Sandbox Code Playgroud) 该项目是:Backbone + Require + Underscore + Grunt + Grunt-Contrib-Jasmine + Grunt-Lib-PhantomJS
所以我一直在与两个严重的问题作斗争.我知道phantomjs运行正常等,因为如果我包含我的应用程序src文件,我会遇到大量的运行时错误.我甚至已经正确地命令了deps,以便Backbone不会_被定义等等.
1)当我包含我的应用程序src时,我收到can't find variable: define所有源文件的错误.我已经尝试将需求放入src[]isntead,vendor[]甚至尝试加载一个包含deps的RequireJSConfig.js.
2)这是cruncher:我很确定我正确地指着我的spec文件.如果我只指向一个测试,它仍然说No Specs Executed. Is there a configuration error?在我的情况下,我只是指向我UserModelUnitTest.js,这很简单.它不会执行.我绝对疯了!
Spec(UserModelUnitTest.js):
describe('User Model Unit Tests', function() {
var USER_MODEL,
USER_CLASS,
JSON_OBJ;
beforeEach(function() {
USER_CLASS = testr('models/user/User', {});
});
afterEach(function() {
USER_MODEL = null;
USER_CLASS = null;
JSON_OBJ = null;
});
describe('Given a json object', function() {
it('should create a valid …Run Code Online (Sandbox Code Playgroud) javascript backbone.js jasmine gruntjs grunt-contrib-jasmine
所以我在PhantomJS中运行了grunt-contrib-jasmine运行规范.有没有办法配置它所以它总是输出_specRunner.html(在浏览器中运行)而不是仅在出错时?
我在doc中看到了这个,但是如何配置这个标志呢?
旗
名称:构建
打开此标志以构建SpecRunner html文件.这在对模板进行故障排除,在浏览器中运行或作为监视链的一部分时非常有用
watch: {
pivotal : {
files: ['src/**/*.js', 'specs/**/*.js'],
tasks: 'jasmine:pivotal:build'
}
}
Run Code Online (Sandbox Code Playgroud) 刚做了一个简单的控制器注入一些.
var SimpleProductListController = BaseController.extend({
_notifications:null,
_productsModel:null,
init:function($scope,ProductsModel,$route){
},
defineListeners:function(){
this._super();
},
destroy:function(){
}
})
/...
SimpleProductListController.$inject = ['$scope','ProductsModel','$route'];
Run Code Online (Sandbox Code Playgroud)
控制台错误指向:http: //errors.angularjs.org/1.2.16/ng/areq?p0 = SimpleProductListController&p1 = not%20aNaNunction%2C%20got%20undefined
Argument 'SimpleProductListController' is not aNaNunction, got undefined
Run Code Online (Sandbox Code Playgroud)
我该如何调试呢?我得到了batarang,但它在这里什么也没做.
我正在尝试在获得焦点时将类添加到输入的父级.我可以得到父母,但我似乎无法设置类名.这是我在这个plunkr尝试的:
http://plnkr.co/edit/eEfSeDb7i3uujjBZt21z?p=preview
<!DOCTYPE HTML>
<html id="ng-app" ng-app="app"> <!-- id="ng-app" IE<8 -->
<head>
<link rel="stylesheet" href="http://nervgh.github.io/css/animate.min.css" />
<style>
.highlight {
border: 2px solid red;
}
.blue-border
{
border:2px solid blue;
}
</style>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script>
angular.module( 'app', [])
.run( function( $rootScope, $timeout ) {
$rootScope.focusInput= function($event )
{
angular.element($event.target).parent().className += " " + 'highlight';
console.log( angular.element($event.target).parent() );
};
$rootScope.blurInput= function($event )
{
angular.element($event.target).parent().className.replace(' highlight', '');
};
});
</script>
</head>
<body>
<div class="blue-border">
<input ng-focus="focusInput($event)" ng-blur="blurInput($event)" value="Lactobacillus acidophilus"/>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
请注意它如何成功记录父项.但是,边框不会变红!还有其他更"Angulary"的做法吗?
angularjs ×6
javascript ×5
jasmine ×2
api ×1
arguments ×1
backbone.js ×1
blur ×1
controller ×1
directive ×1
events ×1
focus ×1
gruntjs ×1
java ×1
jekyll ×1
liquid ×1
onclick ×1
parent ×1
ruby ×1
tws ×1
typescript ×1
unit-testing ×1